Font trouble
Forum rules
and Helpful information
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help
Also, be nice to others! Read the FreeCAD code of conduct!
Also, be nice to others! Read the FreeCAD code of conduct!
Font trouble
Font files often have more than one version of the font inside. Common, for instance, is a bold version of the primary font. It seems to me FreeCAD's ShapeString cannot access those secondary fonts. If I'm wrong here, please tell me how.
So in order to utilise such a secondary font, I used Inkscape to render the text that I need, exporting the contour paths as a SVG file, and importing those into FreeCAD. When I extruded them, some letters gave invalid solids. This was the case with letters that contain a lot of arcs, rather than straight edges. Draft:Downgrading them to a wire, and then edges, allowed me to examine them in detail, and I found the source of the trouble: The contour in those cases is not properly closed. So the letter capital "C" looks like but when the bottom is hugely magnified, it is this: As a test, I removed the tiny edge together with one of the neighbouring edges (arc). Draft:Upgrading and extruding works and gives a valid solid now, but the letter is mutilated as the deleted arc is replaced with an automatically generated straight line, closing the wire.
How to fix this situation? The first step of course is deleting the tiny edge, but how do I close the wire manually, in a proper way? It requires modification of one of the neighbouring edges. It'd be a straightforward job if one of them were a straight line; I could just delete that one, and it'd get automatically closed in the proper way. But how do I modify arcs? The Data/View does not show the arc's parameters. Depending on the parametrisation, the solution may be to replace the arc's end-point coordinates with the coordinates of the adjacent end-point of the other arc (i.e. making the two end-points of the tiny, now deleted, edge identical). But, how to access those parameters?
Cheers Peter
So in order to utilise such a secondary font, I used Inkscape to render the text that I need, exporting the contour paths as a SVG file, and importing those into FreeCAD. When I extruded them, some letters gave invalid solids. This was the case with letters that contain a lot of arcs, rather than straight edges. Draft:Downgrading them to a wire, and then edges, allowed me to examine them in detail, and I found the source of the trouble: The contour in those cases is not properly closed. So the letter capital "C" looks like but when the bottom is hugely magnified, it is this: As a test, I removed the tiny edge together with one of the neighbouring edges (arc). Draft:Upgrading and extruding works and gives a valid solid now, but the letter is mutilated as the deleted arc is replaced with an automatically generated straight line, closing the wire.
How to fix this situation? The first step of course is deleting the tiny edge, but how do I close the wire manually, in a proper way? It requires modification of one of the neighbouring edges. It'd be a straightforward job if one of them were a straight line; I could just delete that one, and it'd get automatically closed in the proper way. But how do I modify arcs? The Data/View does not show the arc's parameters. Depending on the parametrisation, the solution may be to replace the arc's end-point coordinates with the coordinates of the adjacent end-point of the other arc (i.e. making the two end-points of the tiny, now deleted, edge identical). But, how to access those parameters?
Cheers Peter
Re: Font trouble
I would try to fix this at its root: Fontforge is another free program, which can edit the fonts themselves and fix them. You can probably also split the file and make the secondary font directly available to FreeCAD.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Font trouble
AFAIK you are wrong. The bold version of a font is a different file. So all you need to do is select the right file.
F.e. for the Arial font I have 4 files:
arial.ttf
arialbd.ttf
arialbi.ttf
ariali.ttf
For Arial Bold you would need arialbd.ttf.
Re: Font trouble
Ok, I'll try that. It may be beneficial in more than this one aspect. Thanks.
Nevertheless, curiosisty (or call it the drive to learn ) lets me wonder about fixing the arcs. That would be a more generally applicable skill, as situations requiring that are not restricted to font work.
Cheers Peter
Re: Font trouble
Wow.
So just because specifically for the Arial font my statement is not true, you figure it must be wrong in general? What aspect of the word "often" in my statement "Font files often have more than one version of the font inside." is unfamiliar to you?
I suggest you try to find the font file with which FreeCAD can use the "Gungsuh" font. If you're working with Windows, then the font is installed. But you won't be successful, because "Gungsuh" does not exist as a separate file, but is a secondary font in the font file named "batang.ttc", of which the primary font, not surprisingly, is "Batang".
Cheers Peter
PS.: In fact, "Gungsuh" is the second secondary font in the "batang.ttc" file, which comprises the fonts
Code: Select all
Batang
BatangChe
Gungsuh
GungsuhChe
Re: Font trouble
You can edit the points in Draft, which is often convenient for such things.
You can also use Draft Draft2Sketch and edit the corresponding sketch. If possible you can remove offending stuff and add tangent constraints. Alas, this not possible in the middle of a B-spline, where you have to move the control points instead.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Font trouble
Let's return to the facts. This may help clarifying: https://developer.mozilla.org/en-US/doc ... onts_Guide .
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Font trouble
Thanks Chris. I see that @perot is right: there are font files that contain multiple versions. And Draft_ShapeString indeed does not support that.
- wandererfan
- Veteran
- Posts: 6309
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: Font trouble
ShapeString always uses the first typeface in the font file. Assuming the font license allows it, you can create separate files for each typeface using the "Generate Font" command in FontForge.
As for fixing the geometry of individual glyphs, FontForge is your friend here (as @chrisb said). You could edit the wires in FreeCAD, but it is tedious and would have to be repeated for each occurrence of the troublesome glyph.