Re: editing FcConfig in code

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


On 4/14/23 15:55, Akira TAGOH wrote:
Oops, correctly "fullname". No space.

2023年4月14日(金) 23:53 Akira TAGOH <akira@xxxxxxxxx <mailto:akira@xxxxxxxxx>>:

    2023年4月14日(金) 23:11 Idriss Fekir <mcsm224@xxxxxxxxx

        On 4/14/23 12:16, Akira TAGOH wrote:
         > On Thu, Apr 13, 2023 at 10:48 PM Idriss Fekir
        <mcsm224@xxxxxxxxx <mailto: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
         > 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"
         >>>> My goal is, at application startup to check for fonts that
         >>>> 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
         >>> that is the case-by-case. If there are any generally useful
         >>> 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?

        No, i just want for the font to match correctly,
        `fc-match "Isoveka Extrabold Extended Oblique"` should output
        `iosevka-extrabold.ttc: "Iosevka" "Extrabold Extended Oblique"`
        but it doesn't output that. It outputs `NotoSans-Regular.ttf: "Noto
        Sans" "Regular"`, which is wrong since i do have that Iosevka font

    Ah, got it. You set the wrong query string then. What you want to
    would be:

    $ fc-match ":full name=Isoveka Extrabold Extended Oblique"


    $ fc-match "Isoveka:style=Extrabold Extended Oblique"

Unfortunately none of these work correctly, they both output `NotoSans-Regular.ttf: "Noto Sans" "Regular"` (the exact same output as `fc-match "Isoveka Extrabold Extended Oblique"`).

    Though I'm not sure what the real issue was then. I presume that you
    wanted to reproduce your issue on some application with fc-match?

Yes, i'm working on GIMP (it relies on pango) and since current pango doesn't support querying through psname i'm using fullname instead, which works in some cases but in this case doesn't (in general if fc-match outputs the correct font when given the fullname it will work on pango).

        The only way i'm getting the correct font is with
        `fc-match ":postscriptname=Iosevka-Extrabold-Extended-Oblique"`
        i just want the output of:
        `fc-match "Isoveka Extrabold Extended Oblique"`
        to be identical to the output of:
        `fc-match ":postscriptname=Iosevka-Extrabold-Extended-Oblique"`
        (because matching like this with the psname outputs the correct

        Really sorry that my previous question wasn't clear enough.

         > 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
         > 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

        Thank a lot.
-- Idriss
Thanks a lot.
So sorry, i didn't add the mailing list email in CC.

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

  Powered by Linux