Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 242
Rep:
Font File Examination Utility
Hi:
I have a large number of fonts from which I need to identify only those which contain specific Unicode planes.
For example, I would like to be able to run some command (similar to a grep perhaps?) which would return a list of font file names in a directory (along with its subdirectories if need be, so it needs to be recursive) that contained (for instance) Greek and Thai scripts or something like that.
If that isn't feasible, I'd like to have the command search for any such files that contain one or more specific characters/glyphs (in this example perhaps λ or โ, Greek lambda or Thai sera-oh).
I'm aware of the Linux font configuration utility (see man fonts-conf) but, whether because of deficiencies in this utility or (I suspect) misconfigured font files themselves, this doesn't always provide information that is correct. Hence, my wish to just grep the ttf (or whatever) font file itself.
hmm.
my first thought upon seeing the thread title was "fontforge".
typing "font" into a terminal, pressing TAB, gives a few more options, one of them is called fontlint.
i have to hurry now, will look into it tonight.
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 242
Original Poster
Rep:
Great idea: typing font and pressing tab; I hadn't even thought of that, BUT:
I'm familiar with fontlint (George Williams is that author of FontForge which, sadly, no longer seems to be updated). Like its namesake "lint" it reviews a font file (using routines from FontForge) for structural errors and omissions. In my experience many (if not most) fonts are not fully compliant with the various specs for their format. Fontlint is therefore useful for designers, but doesn't address what I'm looking for.
I'm not really sure what you are after. There are 2 commands "ttfdump" and "otfdump" that will dump tons of information about a font. The output is very different, but they both work on both ttf and otf fonts. This command should install both of them:
apt-get install libotf-bin texlive-binaries
Maybe look at the output and see if you can grep the output?
Char 0x03a3 -> Index 860
Char 0x0e01 -> Index 2495
It seems like all (?) that's needed now is to create a recursive loop to examine all of my *ttf files (I haven't tried otfdump yet, but assume it will be similar) - adding the file name to each successful "find".
It would be nice to figure out which fonts support "both", but I've never figured out how to do an AND in grep, so generally just pipe the output from one grep into a second grep; that works but gets rather tedious if ANDing more than two things.
At any rate, your suggestion looks like it has the potential to do what I need. It does seem like more work than should be required in the twenty-first century though, so if anyone knows of a better alternative, I'd love to hear it ...
So, again, thanks much.
P.S. I've always wanted to visit Trondheim because of its great musical culture and heritage, but never had the chance; I'm a little jealous.
so to me it looks like these numerical IDs hold the key to what you're after - does the font support thai or greek encoding?
you'd just have to find out what these numbers mean.
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 242
Original Poster
Rep:
For Ondoho: Quite possibly! I've been playing with Guttorm's suggestions and, as with much of Linux, it seems as if there's an embarrassment of approaches to explore. I'll try to report back if I settle on something that's quick and useful.
For David: Using Writer would be anything but "quick" since I'd have to choose each available font, examine the special character dialog, etc. Above and beyond that, Writer doesn't handle such things well at all (although I suspect that's partly because of flaws in Linux's reading of font characteristics or errors in the formatting of the fonts themselves). It's quite well known that, in Linux, Writer will often substitute the font used for some characters even if the current font contains those characters - great program, but tricky to use when intermixing more than one script at a time, particularly since you sometimes need to fight with its "Complex Text Layout."
My actual objective is to identify the fonts that can be used when putting together a document that uses several different combinations of scripts.
And Thanks to you both for the responses - it's becoming evident that this can be done - I just need to work out what's the best approach for my purpose.
It's quite well known that, in Linux, Writer will often substitute the font used for some characters even if the current font contains those characters
Only when outputing text, not in the choice box.
I don't know how many fonts you use — I only use 16 — but I compiled a text giving sample alphabets in each available variant (bold, small-caps, etc) and other details. So Cardo has no variants, is a Garald with a small x-height, the 12 point is actually 12 on 15, it includes Old Italic and Hebrew, I've added the Gothic and Old Cyrillic, etc. Fun to compile and quite useful.
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 242
Original Poster
Rep:
Correct, but then outputting text is really the point, isn't it?
I use quite a few fonts depending on the particular project; among the needs are several written scripts (mostly English/Latin/Roman/Lower Ascii, Thai and Greek, but several projects have included more) and a number of specialty scripts such as music symbols. For any ONE project, though, the number of primary fonts usually isn't more than two or three.
It's interesting that you mention the "12 on 16" sort of designator: this becomes interesting when mixing multiple scripts, since languages such as Thai have actual characters (i.e. vowels and tone marks as well as simple diacritics) that are placed above and below other characters. Getting acceptable line spacing with mixed language sentences (e.g. "the Greek phrase 'xxx' means 'yyy' in Thai") while keeping the size of the base characters reasonably similar can sometimes be "interesting."
Mixing languages is also interesting when the distinctions among serif/sans-serif/italic is utterly irrelevant to one or more of them.
These and other considerations are what is driving this effort: I decided I was going to compile some sample docs such as you described (one for each group of languages that needed to be used together), but soon discovered that searching for the fonts that had a particular group of scripts was quickly becoming extremely tedious.
Based on the earlier responses to this post I'm beginning to see that such a utility can be constructed, and I'm now messing around with exactly how I want to use it - leading, as usual, to completely ignoring the actual project that drove me to this in the first place so that I can design the "perfect" solution - always fun when the problem itself is constantly changing.
But, that's how we Linux users get our kicks I suppose.
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 242
Original Poster
Rep:
In an attempt to "solve" my original question ("How do I generate a list of fonts that contain support for specific scripts/languages?), I've written a prototype bash shell script to do that; there is also an attached pdf that explains why it exists, how to use it, how to modify it and so forth.
I should mention that this need is primarily driven by experiencing unwanted font substitutions in LibreOffice Writer and other applications. The primary cause of these seems to be the use of fonts that either don't have or don't correctly report their coverage and other capabilities. This is particularly annoying when intermingling multiple scripts/languages within a single sentence, paragraph, or document.
The shell script will help to select fonts that are appropriate for a given combination of scripts/languages, as well as identify which fonts should perhaps be retired to the great font foundry in the sky and replaced with better ones.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.