[SOLVED] define cxf font

Use this forum to ask questions about how to do things in QCAD.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
smf
Premier Member
Posts: 177
Joined: Tue Feb 28, 2012 1:05 pm

[SOLVED] define cxf font

Post by smf » Wed Aug 01, 2012 1:42 pm

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
Last edited by smf on Thu Aug 02, 2012 9:05 pm, edited 1 time in total.

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: define cxf font

Post by andrew » Wed Aug 01, 2012 8:54 pm

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).

smf
Premier Member
Posts: 177
Joined: Tue Feb 28, 2012 1:05 pm

Re: define cxf font

Post by smf » Thu Aug 02, 2012 11:18 am

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
Last edited by smf on Thu Aug 02, 2012 3:54 pm, edited 1 time in total.

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: define cxf font

Post by andrew » Thu Aug 02, 2012 3:35 pm

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).

smf
Premier Member
Posts: 177
Joined: Tue Feb 28, 2012 1:05 pm

Re: define cxf font

Post by smf » Thu Aug 02, 2012 3:52 pm

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...

smf
Premier Member
Posts: 177
Joined: Tue Feb 28, 2012 1:05 pm

Re: define cxf font

Post by smf » Thu Aug 02, 2012 4:02 pm

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:

smf
Premier Member
Posts: 177
Joined: Tue Feb 28, 2012 1:05 pm

Re: [SOLVED] define cxf font

Post by smf » Sun Aug 05, 2012 11:10 am

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. :(

Post Reply

Return to “QCAD 'How Do I' Questions”