You are not logged in.

#1 2019-07-23 09:30:43

Markus00000
Member
Registered: 2011-03-27
Posts: 315

[SOLVED] Check if font package can provide ttf-font

How can I make sure a font package containing sans-serif, serif and monospace variants can provide ttf-font?

Any commands that tell me the matching will work?

SOLUTION

Read Todo List: Fix 'ttf-font' default font setup.

Let’s look at an example. The noto-fonts package installs sans-serif, serif and monospace fonts. To be able to provide ttf-font, fontconfig files must be installed that create the following font aliases:

sans-serif -> Noto Sans
serif -> Noto Serif
monospace -> Noto Sans Mono

To achieve this, noto-fonts installs these files and symlinks:

etc/
└── fonts
    ├── conf.avail
    │   ├── 66-noto-mono.conf
    │   ├── 66-noto-sans.conf
    │   └── 66-noto-serif.conf
    └── conf.d
        ├── 66-noto-mono.conf -> ../conf.avail/66-noto-mono.conf
        ├── 66-noto-sans.conf -> ../conf.avail/66-noto-sans.conf
        └── 66-noto-serif.conf -> ../conf.avail/66-noto-serif.conf

For example, 66-noto-sans.conf contains:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <alias>
    <family>sans-serif</family>
    <prefer>
      <family>Noto Sans</family>
    </prefer>
  </alias>
  <alias>
    <family>Noto Sans</family>
    <default>
      <family>sans-serif</family>
    </default>
  </alias>
</fontconfig>

With the font aliases configured and the other requirements mentioned in the above link met, the package can provide ttf-font.

Last edited by Markus00000 (2019-07-28 07:45:12)

Offline

#2 2019-07-23 12:35:04

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 7,135

Re: [SOLVED] Check if font package can provide ttf-font

Archlinux has a virtual pacakge, ttf-font .

Every package with True Type Fonts should have provides=ttf-font .
pacman -Qi ( or -Si if pacakge is not installed) and repo webinterface all show provides.

If you want to know which font will be used on a specific machine,  man fc-match .


Multi-init booting with apg Openrc and systemd coexisting
Automounting : not needed, i prefer pmount
Aur helpers : makepkg + my own local repo === rarely need them

Offline

#3 2019-07-26 08:44:55

Markus00000
Member
Registered: 2011-03-27
Posts: 315

Re: [SOLVED] Check if font package can provide ttf-font

I read that ttf-font is a virtual package that can be provided by other packages if they contain sans-serif, serif and monospace fonts. Is this correct?

If so, then the question becomes how to make sure that the fonts in a package will actually provide the ttf-font fonts. That is, the fonts are found/matched correctly when another package relies on ttf-font to be present.

Offline

#4 2019-07-26 20:51:09

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 7,135

Re: [SOLVED] Check if font package can provide ttf-font

I read that ttf-font is a virtual package that can be provided by other packages if they contain sans-serif, serif and monospace fonts. Is this correct?

https://www.archlinux.org/todo/fix-ttf- … ont-setup/ has some more details.


I do have a feeling however we have an x-y problem and/or I don't understand your issue .

Please elaborate on what you want to achieve with the package /application you're working on.


Multi-init booting with apg Openrc and systemd coexisting
Automounting : not needed, i prefer pmount
Aur helpers : makepkg + my own local repo === rarely need them

Offline

#5 2019-07-27 08:15:33

Markus00000
Member
Registered: 2011-03-27
Posts: 315

Re: [SOLVED] Check if font package can provide ttf-font

Thanks for your patience and help so far!

Goal: Determine whether or not a package should provide ttf-font.

From the linked page:

3. have at least three families, one each an alias of:
- sans-serif
- serif
- monospace

as determined by fontconfig.

How to determine this with fontconfig?

I tried running

fc-match -s monospace

, but the output includes many fonts that are not monospace. For example, it shows Libertinus Sans, Libertinus Serif and Libertinus Mono. It seems to me that this is not the command I am looking for.

Offline

#6 2019-07-27 18:00:32

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 21,899
Website

Re: [SOLVED] Check if font package can provide ttf-font

Can we stop working in hypotheticals.  What font(s) are you actually working with?  In your first post, your stated that the package in question provides a sans, serif, and monospace variant.  That package then meets the criteria for ttf-font.

fc-match gives information about the fonts currently installed and configured on your system - that's not relevant to what it seems this thread was about.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#7 2019-07-27 18:48:46

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 7,135

Re: [SOLVED] Check if font package can provide ttf-font

Goal: Determine whether or not a package should provide ttf-font.

Why do you need that info and what do you want to do with it ?


How to determine this with fontconfig?

I tried running

fc-match -s monospace

, but the output includes many fonts that are not monospace. For example, it shows Libertinus Sans, Libertinus Serif and Libertinus Mono. It seems to me that this is not the command I am looking for.

You may be misunderstanding what those terms mean.

Monospace refers to a font where all symbols have the same width aka non-proportional .
The best known example of a monospaced font is the font used by typewriter machines .

Serif and sans-serif are very close to eachother, the difference is best shown visually .
https://en.wikipedia.org/wiki/Serif , look at top right image.
I do think both are a proportional font, but don't know if that's mandatory or not.


fc-match -s monospace shows a list of all installed alternatives for a monospaced font that fontconfig2 is aware of.
If that list includes Libertinus sans, the author/packager of Libertinus sans feels it's suitable to be used when a document or application requests a monospaced font.


Multi-init booting with apg Openrc and systemd coexisting
Automounting : not needed, i prefer pmount
Aur helpers : makepkg + my own local repo === rarely need them

Offline

#8 2019-07-27 20:37:49

Markus00000
Member
Registered: 2011-03-27
Posts: 315

Re: [SOLVED] Check if font package can provide ttf-font

Trilby wrote:

Can we stop working in hypotheticals.  What font(s) are you actually working with?

Right now: Noto Sans, Noto Serif, Noto Sans Mono and others from the Noto family.

Another time the fonts will be different. That is why I was asking generally.

Trilby wrote:

In your first post, your stated that the package in question provides a sans, serif, and monospace variant. That package then meets the criteria for ttf-font.

The above link goes beyond this requirement.

In particular, the fonts must be aliases of sans-serif, serif and monospace “as determined by fontconfig.” I do not know if the font files I have fulfill this requirement as I do not know how fontconfig determines this. Hence the question.

Trilby wrote:

fc-match gives information about the fonts currently installed and configured on your system - that's not relevant to what it seems this thread was about.

As I have these fonts installed, I wondered if fc-match could tell me whether the fonts are aliases of sans-serif, serif and monospace.

Lone_Wolf wrote:

Why do you need that info and what do you want to do with it ?

To decide whether my PKGBUID should contain `provides=('ttf-font')` or not.

If, for example, the Noto package in question provided ttf-font, users would not need to install another package when they need ttf-font. On the other hand, if the package provided ttf-font but was not working correctly, I would supply users with a broken ttf-font provider, which I would rather not do.

Lone_Wolf wrote:

You may be misunderstanding what those terms mean.

Thanks for the explanation, however, I know the terms.

Offline

#9 2019-07-27 20:54:16

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 21,899
Website

Re: [SOLVED] Check if font package can provide ttf-font

Markus00000 wrote:

In particular, the fonts must be aliases of sans-serif, serif and monospace “as determined by fontconfig.” I do not know if the font files I have fulfill this requirement as I do not know how fontconfig determines this. Hence the question.

That's what the remainder of the content at that link is all about.   If the font in question is one of the one's listed, their alias's are convered by fontconfig, otherwise, your package should provide a alias config file.  Look at the existing one's for an example of what's needed.

But still it's not clear what angle you're coming at this from: are you packaging existing fonts, modifying existing fonts, creating your own brand new fonts from scratch, or what?

Markus00000 wrote:

If, for example, the Noto package in question provided ttf-font, users would not need to install another package when they need ttf-font. On the other hand, if the package provided ttf-font but was not working correctly, I would supply users with a broken ttf-font provider, which I would rather not do.

Where's the PKGBUILD and associated files for this?  Is it already up in the AUR?  Which packages?  Does the package provide alias config file(s)?  How is this package different from the noto-fonts package(s) in the repos?

Last edited by Trilby (2019-07-27 20:54:41)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#10 2019-07-27 21:27:16

Markus00000
Member
Registered: 2011-03-27
Posts: 315

Re: [SOLVED] Check if font package can provide ttf-font

Trilby wrote:

If the font in question is one of the one's listed, their alias's are convered by fontconfig

Okay, Noto is not listed.

Trilby wrote:

otherwise, your package should provide a alias config file.  Look at the existing one's for an example of what's needed.

I think I’m starting to understand. So, “as determined by fontconfig” means “if a fontconfig file contains an <alias> section for the sans-serif, serif and monospace families,” which, for example, noto-fonts does.

Trilby wrote:

are you packaging existing fonts, modifying existing fonts, creating your own brand new fonts from scratch, or what?

Packaging existing fonts.

Trilby wrote:

Where's the PKGBUILD and associated files for this?  Is it already up in the AUR?  Which packages?  Does the package provide alias config file(s)?  How is this package different from the noto-fonts package(s) in the repos?

It’s noto-fonts-main in the AUR. It doesn’t contain alias config files. It contains a different selection of fonts.

If I understand correctly, I can add fontconfig files to configure the aliases and then make the package provide ttf-font.

If so, you solved this issue – even in the hypothetical general case. Thank you very much!

Offline

#11 2019-07-27 21:49:35

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 21,899
Website

Re: [SOLVED] Check if font package can provide ttf-font

Markus00000 wrote:

If I understand correctly, I can add fontconfig files to configure the aliases and then make the package provide ttf-font.

I believe so, yes.  Though with a big caveate that fontconfig has always seemed like some weird dark magic to me.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

Board footer

Powered by FluxBB