CXF file format description?

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
scruss
Newbie Member
Posts: 5
Joined: Mon Nov 01, 2010 1:07 am

CXF file format description?

Post by scruss » Tue Dec 16, 2014 5:36 am

Hi - I'm a happy QCAD Pro user, but I have another lower-level project that could really use some simple vector fonts. Is there any documentation for the CXF format?

Thanks,
Stewart

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

Re: CXF file format description?

Post by andrew » Tue Dec 16, 2014 11:54 am

The format of the glyphs in .cxf files is:

Code: Select all

[<hex unicode>] <character (optional for better readability)>
<'L' for line> <start x>,<start y>,<end x>,<end y>
<'A for arc (CCW)'> <center x>,<center y>,<radius>,<start angle in degrees>,<end angle in degrees>
<'AR for reversed arc (CW)'> <center x>,<center y>,<radius>,<start angle in degrees>,<end angle in degrees>
Example for 'C' in fort standard:

Code: Select all

[0043] C
L 4,9,2,9
A 2,7,2,90,180
L 0,7,0,2
A 2,2,2,180,270
L 2,0,4,0
Capital letters are typically defined between Y=0 and Y=9 with the left border at X=0.

In the header, the letter spacing, word spacing, line spacing and scale (if height!=9) can be defined.

Perhaps you could briefly indicate what you are doing and why you need line fonts vs. TrueType fonts and why the available fonts are not sufficient. Perhaps there is a better solution than creating a new font.

scruss
Newbie Member
Posts: 5
Joined: Mon Nov 01, 2010 1:07 am

Re: CXF file format description?

Post by scruss » Tue Dec 16, 2014 1:29 pm

Thanks, Andrew! Much appreciated.
andrew wrote:Perhaps you could briefly indicate what you are doing and why you need line fonts vs. TrueType fonts and why the available fonts are not sufficient. Perhaps there is a better solution than creating a new font.
Sure! I'm driving old HP-GL pen plotters from Python. I'm using the Shapely and Fiona libraries to handle 2D geometry and arbitrary vector file formats. HP-GL's text formatting is weak and old fashioned. If I'm able to use someone else's vector fonts, I'll be able to render complex characters as vectors and plot them on any device.

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

Re: CXF file format description?

Post by andrew » Tue Dec 16, 2014 4:53 pm

Sure! I'm driving old HP-GL pen plotters from Python. I'm using the Shapely and Fiona libraries to handle 2D geometry and arbitrary vector file formats. HP-GL's text formatting is weak and old fashioned. If I'm able to use someone else's vector fonts, I'll be able to render complex characters as vectors and plot them on any device.
Ah, makes sense now :) I thought you were going to create your own CXF fonts.
I hope the QCAD fonts will be useful for your project!

scruss
Newbie Member
Posts: 5
Joined: Mon Nov 01, 2010 1:07 am

Re: CXF file format description?

Post by scruss » Wed Dec 17, 2014 12:43 pm

Well, about as much sense as wanting to run a large, slow, loud (but mesmerizing) pen plotter ever would! ;-)

I did see one other command used: AR, as in the & character in the Cursive font:

Code: Select all

[0026] &
L 4.9832,0,2.997,6.9891
AR 4.2844,7.3549,1.3384,195.865,307.833
L 5.1053,6.2979,1.2595,3.3113
A 2.3943,1.8501,1.8501,127.833,307.833
L 3.5291,0.3889,6.7596,2.8978
Is that any different from the regular Arc command, please?

lgreng
Junior Member
Posts: 11
Joined: Fri Sep 12, 2014 5:24 pm

Re: CXF file format description?

Post by lgreng » Sun Jul 26, 2015 7:29 pm

Is there a way to create a filled shape with this, such as '●' ?

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

Re: CXF file format description?

Post by andrew » Mon Jul 27, 2015 9:52 am

lgreng wrote:Is there a way to create a filled shape with this, such as '●' ?
No, CXF fonts are strictly lines and arcs by definition. TTF fonts on the other hands contain only filled surfaces.

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”