CXF fonts upgrade

Drop in here to discuss whatever you want.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
CVH
Premier Member
Posts: 3415
Joined: Wed Sep 27, 2017 4:17 pm

CXF fonts upgrade

Post by CVH » Sun Jun 23, 2019 7:21 pm

From version 3.22.1 on CXF fonts are editable and support polylines.
This is a major upgrade to the CXF functionality and comes as a surprise.
Some years ago I had an elaborated discussion about CXF and exploding to entities/paths.
As engraver I saw the potential for single strike fonts what no TTF and many others can be.
The problems occurred as they were exploded to entities and recombined to paths.
Some Arcs failed to connect due to how they are defined, some glyphs were not exploded as they were coded.
The explode option from text glyphs to polylines in the AppPrefs is a result of that.

In some rare cases it still doesn't end up well like the '0' (zero) in the TTF Arial Unicode MS.
Maybe Andrew can find out if it is a bad TTF coding or a QCAD issue?
Believe me, I encountered lots of poorly drawn glyphs in TTF fonts.

Soon we learned to edit the CXF fonts in a text editor.
L is a line definition with x1,y1,x2,y2.
A and AR are arc definitions with center x1,y1,radius,startangle,endangle.
The R means reversed or CCW.
Easy as pie.

Arcs in polylines are stored in a different way and should always connect by definition.
PL and PLC are polyline definitions with knot x1,y1,bulge1,knot x2,y2,bulge2 and so on.
The C means closed and in that case the endpoint of the poly is not recorded as it is the startpoint.
A zero bulge is a straight line and a bulge of 1 is a 180 degrees arc.
The sign indicates the side to where to bulge, positive is at the right hand side.
Centerpoint and radius are calculated from the bulge and the start- & endpoint to be fitted.
This math cannot define a full 360 degrees arc.

As we change, correct or add something to a CXF font it is of interest to keep a copy apart to protect it from being

overwritten while upgrading to a newer version of QCAD.

It's a pity that the definitions, the references and the coding changed over time.
The decimal accuracy used to be even up to 9 digits, now it seems to be 4 digits.
Meaning that for 9 units large glyphs the error is 0.0001 units or 0.1mm for 9 meter large symbols.
Plenty enough.

I found out that we can't simply copy glyphs text from version 2 to 3. A text coding problem.
I tried to convert to UTF8 first but with no luck. Opening a version 2 option isn't an option either.
Also, while saving a CXF font the 'EndOfLine' changes from 'NewLine' to 'Carriage Return' + 'NewLine'.
But this doesn't affect the functionality.

I dug up my version of SansND.cxf
A simple and fine font for narrow 2-line engraving and most of the common glyhps are present.
I corrected some glyphs in the past so I was interested in any change.
With the newly installed version there are still some old faults and there are newer ones.
In special: version 2 had 245 glyphs, version 3 only 98 glyphs.
Once past the UTF coding problem it was easy redone.
Details below, file attached.

If the errors in the fonts are that obvious where should we send corrections to?

Andrew, I was happily surprised with the upgrade.
We even can predefine in what direction a path should be cut.
With 'Select All' + Reverse we can change from conventionally milling to climb milling.
Paths from CXF can be made 'clean' without crossings, openings or null-lenght entities.
Sorry, but I still prefer to use a CAM that generates spiral pockets and it doesn't tolerate any of these artifacts.

Kind regards,
CVH




Details SansND.cxf >> SansNDv2.cxf
Glyphs weight rather half of common 1/7 height.
Closed letters with cutter OD>1/22 height (some features lost, some not cut).
Suitable for engraving open or outline glyphs with cutter OD<1/40 height.
Suitable for pocketing as a very narrow font, weight rather 1/36 height.
The letter spacing is larger so it mimics glyphs placing similar to some common TTF fonts.

QCad II Font Version: 2.0.5.0 245 glyphs
QCAD 3 Font Version: 3.22.1 only 98 glyphs

0x0025 % >Only 6 of the 8 arcs where defined; Lower end of slash corrected
0x0026 & >Crossing corrected and closed as 1
0x0028 ( >Orphan corrected and closed as 1
0x002a star >Mid corrected and closed as 1
0x002f slash >Lower end corrected
0x0030 0 >Inner was open, ellipse redraw, exploded & offset
0x0032 2 >Lower left corrected and closed as 1
0x0033 3 >Lower left duplicate orphan removed
0x003f question mark >Start-end crossing corrected
0x0040 @ >3 crossings in 'a' corrected and closed as 1
0x0041 A >Lower left corrected
0x0042 B >Crossing upper inner bulge corrected and closed
0x004b K >Left connection opened, combined and closed as 1
0x0051 Q >Lower right corrected
0x007b { >Lower corrected and closed as 1
0x007d } >Lower corrected and closed as 1
0x007e ~ >Misalignment corrected and closed as 1
0x00c5 Å >Corrected A[0x0041] with o from QCad II Font Version: 2.0.5.0
0x0105 ą >Corrected below at the c and closed as 1

Added 147 entrys from Version: 2.0.5.0
Small corrections and mods, some duplicate orphans removed.
Converted to polylines.

Full circles defined as open polyline with two semi-circle segments.
Outside features CW & inside features CCW for engraving as conventional milling.
Attachments
SansNDv2.cxf
revised by CVH
(43.67 KiB) Downloaded 624 times

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

Re: CXF fonts upgrade

Post by andrew » Mon Jun 24, 2019 9:13 am

Thanks for your contribution, I've updated the font file accordingly.

Post Reply

Return to “Chat”