Re: editing FcConfig in code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 13, 2023 at 10:48 PM Idriss Fekir <mcsm224@xxxxxxxxx> wrote:
> Sorry, my question wasn't clear, what i meant is, is there a way in in
> the config file to say, "if given this string, match it to this psname,
> or this full_name", e.g: if given "Iosevka Extrabold Extended Oblique"
> match it to the font with psname:"Iosevka-Extrabold-Extended-Oblique".

No. we could guess a postscript name from family and/or fullname but
it is't perfect because they are stored as independent metadata. they
are free to set regardless of regularity.

So you need to do compare "family" and "postscriptname" separately.

> >> My goal is, at application startup to check for fonts that aren't
> >> matched properly, then remap then load the config, is there a general
> >> solution?
> >
> > That depends on the meaning of "not matched". speaking of the fallback
> > font, that is exactly what fontconfig does. In case of your issue,
> > that is the case-by-case. If there are any generally useful solutions,
> > please let us know.
> >
>
> What could be done in this particular case? that is,
> `fc-match "Isoveka Extrabold Extended Oblique"` outputs
> `Noto Sans Regular` instead of the correct font.

You want to substitute it with Noto Sans no matter what they exist and
change the weight and the slant too?
I didn't test but this may *theoretically* works:

<match>
  <test name="fullname">
    <string>Isoveka Extrabold Extended Oblique</string>
  </test>
  <edit name="family" mode="prepend">
    <string>Noto Sans</string>
  </edit>
  <edit name="weight" mode="prepend">
    <const>regular</const>
  </edit>
  <edit name="slant" mode="prepend">
    <const>roman</const>
  </edit>
</match>

This assumes that applications request a font with fullname. you may
need to replace it with "family", and "style" or "weight" and "slant"
in some case.
If you want to fallback only when they aren't available, that may be
much more complicated.

> Another question, what does `FcConfigSubstituteWithPat` do, i couldn't
> understand from the man page.

Well, there are three matching patterns in fontconfig. "pattern",
"font", and "scan". These patterns are performed only when "kind" is
the same. however, if you call FcConfigSubstituteWithPat(config,
pfont, ppat, FcMatchFont) then, you can get both "pattern" in ppat and
"font" in pfont FcPatterns. see FcFontRenderPrepare() for more
details.

>
> Sorry for asking so many questions.
>
> Thank.
> --
> Idriss



-- 
Akira TAGOH




[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux