CXF fonts are CAD specific line fonts. These can be created and edited with QCAD.
Table of Contents
QCAD comes with a collection of line fonts in its own CXF format. Line fonts are sometimes used in CAD instead of TrueType fonts. Line fonts are also often used for engraving or other further processing. QCAD can use any TTF font installed on the system and CXF fonts available in its fonts directory.
QCAD can load and edit fonts in CXF format.
Opening a CXF Font for Editing
To load an existing CXF font file in QCAD to view and edit its glyphs, simply use the menu File > Open and choose the format filter "CXF Font Files (*.cxf)". Then choose the font file you want to open. The fonts that come with QCAD are stored in directory "fonts" of your QCAD installation.
Note that depending on your installation path, your login credentials and your operating system, this directory might be read-only. In this case, you might want to move the font file to another folder for editing.
Editing a CXF Font
The font glyphs (representation of the various letters and symbols in the font) are loaded into QCAD as block definitions. Make sure the block list is visible (View > Block List), so you can easily navigate through the font glyphs. Each block representing a glyph has a name in the format "[Hexadecimal Unicode] [Character]", for example "0x0041 A" for a capital "A" with Unicode 65 (41 in hexadecimal). To open and edit a font glyph, double-click on its block. The glyph is then shown in the graphics view of QCAD:
Auxiliary lines may be shown, depending on the font. These are not part of the font and are only meant to provide some guidance when creating and editing glyphs. You can switch the auxiliary lines off by switching off layer "Auxiliary".
Geometry of Glyphs
By convention of the CXF format, a capital "A" should be constructed with a height of 9 drawing units. When the font is used for a text entity, it is scaled by QCAD according to the text height chosen by the user. Glyphs should have their reference point 0,0 at the lower left corner of the baseline. In the CXF format, glyphs can contain lines, arcs and polylines. Splines may be used, but are converted into polylines during export.
Adding New Glyphs
To add a new glyph currently not present in a font you need to add a new block with the name [Hexadecimal Unicode] [Character], for example "0x0041 A" for a capital A. You can look up Unicode codes in the Code Charts section of the official web site of the Unicode Consortium. If a font already contains glyphs for many characters, you might want to copy an existing block with a similar glyph using Block > Copy Block.
Saving a CXF Font
Font files can be saved like drawing files using File > Save or File > Save As. QCAD needs to be restarted to reinitialize all the CXF fonts in its "fonts" directory.
CXF File Header
CXF fonts store additional information about the font in a simple, human readable font header. This information can be edited with a text editor or within QCAD as follows:
- Make sure that the property editor shows properties from layers:
Edit > Application Preferences > Widgets > Property Editor:
Tick the option "Display properties of current block and current layer"
- Activate layer "0" in the layer list (View > Layer List).
- In the property editor (View > Property Editor), change the selection at the top from "All" to "Layer". The property editor now shows properties of layer "0".
- Use the property editor to change the meta information of the CXF font:
- Authors: comma separated list of font authors
- AuxiliaryLines: comma separated list of auxiliary line positions and angles in the format:
x1,y1,angle1, x2,y2,angle2, ...
- Encoding: font encoding (should be "UTF-8")
- LetterSpacing: space between two letters
- WordSpacing: space between two words
- LineSpacingFactor: can be used to increase / decrease default line spacing
- Names: comma separated list of font names / aliases for this font