Page 1 of 1

[SOLVED] define cxf font

Posted: Wed Aug 01, 2012 1:42 pm
by smf
I have an (old) font definition as ascii text containing only lines between points. I want to use this font in QCad 3 and therefore wrote a small converter, which creates a cxf file - therein is for example

Code: Select all

[0031] 1
L 41,163,58,172
L 58,172,87,200
L 87,200,87,0

[0044] D
L 9,0,9,200
L 9,200,68,200
L 68,200,97,188
L 97,188,122,150
L 122,150,131,122
L 131,122,131,75
L 131,75,122,47
L 122,47,114,25
L 114,25,97,9
L 97,9,68,0
L 68,0,9,0
This seems to work for single characters, but some characters seem to have (near) zero width and all of them have near zero height.

So there are two questions: Is the "comment looking" header of the cxf not a comment but a character definition? Am I doing something completely wrong?

Thanks in advance
Stefan

Re: define cxf font

Posted: Wed Aug 01, 2012 8:54 pm
by andrew
The header is required. It defines character and word spacing and the glyph height used for the calculation of the scale factor that is applied to each glyph (typically the height of a capital A).

Re: define cxf font

Posted: Thu Aug 02, 2012 11:18 am
by smf
Many thanks! :D

I added

Code: Select all

# Format:            QCad II Font
# Creator:           ConvertFntToCxf
# Version:           1.0.0
# Name:              vfont1
# LetterSpacing:     300
# WordSpacing:       675
# LineSpacingFactor: 1
# Author:            smf
and can adjust horizontal spacing. I think :wink: that LetterSpacing controls spacing between each character and WordSpacing controls space for "space". Unfortunately adjusting LineSpacingFactor (tried values from 1 to 1000000) does not change vertical spacing. So: how can I adjust the height?

Another question: is it possible to fix the width of all characters (making "i" taking the same space as "m" for example)?

Thanks again!
Stefan

Re: define cxf font

Posted: Thu Aug 02, 2012 3:35 pm
by andrew
smf wrote:how can I adjust the height?
A glyph is actually expected to be 9 units tall (for a capital A). This seems to be fixed. The word and letter spacing should be values that make sense for a text with height=9.
smf wrote:Another question: is it possible to fix the width of all characters (making "i" taking the same space as "m" for example)?
No, monospaced fonts are not supported (except for TTF fonts such as Courier).

Re: define cxf font

Posted: Thu Aug 02, 2012 3:52 pm
by smf
Thanks again, those hints did the trick! :D

Some of the characters (mainly "i", "I", "l", "1") seem to have no or too less letter spacing. Is only the first polyline taken into account, or is there a minimum width of characters?

I have a pdf showing my problem, but can't attach it...

Re: define cxf font

Posted: Thu Aug 02, 2012 4:02 pm
by smf
Oh, I think I found the answer myself - those are the only characters that do not fill the complete width which all other characters fill. :( Without a monospace option, I will have to add a horizontal line to have those characters centered and some kind of "monospacing" - or write a converter to truetype fonts. :roll:

Re: [SOLVED] define cxf font

Posted: Sun Aug 05, 2012 11:10 am
by smf
Now I insert smalls dots in the left and right bottom corner which results in a monospaced font. Unfortunately there are now unwanted dots, of course. :(