Login  Register

Re: Default font selection and automatic assignment for unrecognized fonts

Posted by marko.p.radojcic on Dec 11, 2023; 5:28am
URL: https://forum.librecad.org/Default-font-selection-and-automatic-assignment-for-unrecognized-fonts-tp5723999p5724003.html

dxli wrote
Hi Marko,

Where do you get the font data?

If it's Unicode, you can search other Unicode fonts to look for a backup.

If it's not Unicode, it's getting harder, because you cannot use an ASCII font for a symbol, for example.

Another thought, can we use ttf2lff at dxf loading time to create lff from system fonts, if font looking up fails. Or from some free ttf fonts online. Basically, making the lff management automatic.
First of all, thank you @dxli.

My intended workflow would be to convert and install (if needed) a default font.
Then, using RS::FontList class to show available fonts in a dropdown somewhere in preferences as a selection for default font.
This font would be assigned to unrecognized fonts as a default.

So a GUI addition to allow a new setting ( and record in preferences backend) the default font.
Managing ASCII and Unicode separately is a good pointer, thank you.
And lastly to assign this font to unrecognized fonts during drawing load time.

Converting already existing fonts on the system to .lff is very interesting, and I will take it into account.

Downloading an open font on the fly could be messy and if it happens too often whenever someone starts using LibreCAD might result in a server crash or a ban of some kind (even if it is available on a known static URL). Instructing user to download and convert a font is good, which is already well documented.

The unicode font in librecad does not have support (ar at least it doesn't work) for many Serbian Cyrillic or even Serbian Latin characters. Neither does the cyrillic_i and cyrillic_ii. I guess this might be a problem for other languages too.

I (on my own machine) used Unifont that works well (it is a large Unicode font, unfortunately even though I think license is compatible, the converted font is too big to fit in the installer image).
It is not perfect in terms of appearance, the converted .lff is blocky, but it is correct and legible.

I will take into account your comments. I plan to learn more on this topic in LibreCAD during next couple of weekends and do the actual development work over the New Year's holidays.

Marko