Re: Another proposal for saving custom fonts in fontconfig

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

 



Hi,

On Wed, 2019-06-26 at 18:07 +0900, Akira TAGOH wrote:
> Hi,
> 
> On Wed, Jun 26, 2019 at 4:14 PM Peng Wu <peng.e.wu@xxxxxxxxx> wrote:
> > Hi,
> > 
> > In order to support saving custom fonts from variable fonts in
> > pango,
> > we propose to saving the information in fontconfig XML.
> > 
> > URL: https://gitlab.gnome.org/GNOME/pango/issues/350
> > 
> > Here are some thoughts about C API and fontconfig XML syntax.
> > 
> > For C API, I think some bool property like FC_CUSTOM_FONT will need
> > to
> > be added.
> 
> What is that for?
> 

I think this is for pango to check whether this is normal font style
or custom font style. With custom font style, maybe some remove button
will appear.


> > And some API to write or remove the custom fonts maybe also needed.
> > 
> > For C API:
> > 
> > To create the custom font file:
> > FcPublic FcBool
> > FcConfigCreateCustomFont(FcPattern *origin, FcPattern *custom);
> > 
> > To remove the custom font file:
> > FcPublic FcBool
> > FcConfigRemoveCustomFont(FcPattern *custom);
> 
> Are you expecting to input/output from/to file in fontconfig?
> I'm not yet fully understanding what exactly you want with it though,
> is it created/modified/removed by users and happens so often?
> What exactly the use case is it?
> 

These API is used to create/remove the custom font file, I just think
it is easier to handle it in fontconfig.

It is also okay for me to create/remove the custom font file
in other library.

FcConfigCreateCustomFont will create the custom font file,
FcPattern *origin will create the below content:
'''
        <origin>
                <family>Variable Font Family</family>
                <style>Style Name</style>
        </origin>
'''
FcPattern *custom will create the below content:
'''
        <custom>
                <family>Variable Font Family</family>
                <style>Custom Style Name</style>
                <fontvariations>AXIS1=VALUE;AXIS2=VALUE</fontvariations
>
        </custom>
'''

FcConfigRemoveCustomFont will remove the matched custom font file.
FcPattern *custom will try to match family name and custom style name.


> > After fontconfig finish font loading, the "origin" element will
> > match
> > the existing fonts, and the "custom" element will copy and modify
> > the
> > matched font,
> > then save the new font as normal font pattern into FcFontSet.
> 
> What you said the above can be done without any changes even at this
> point, with FcFontMatch(). but FcFontList(). you can't expect any
> operations to rebuild the list with some modifications in
> FcFontList()
> like FcFontMatch() does. that will affects a lot to the performance.
> "custom" you said in your mail must be extracted prior to add to the
> list. what you can expect on FcFontList() is only filtering.
> 
> Anyway, please elaborate more on use cases and requirements for
> input/output through fontconfig API.
> 

Sorry, pango prefers to use FcFontList.

And the custom fonts information will only run once after fontconfig
finish loading the XML and font files.

After fontconfig finish loading, each custom font style information
will go through the FcFontSet, and match the font, copy, modify and
insert back the font into FcFontSet.
Then FcFontList will return the fonts with custom font style together
for pango.

This approach will only affect the loading time of fontconfig
depending on how many custom font style are defined.

Thanks,
  Peng

> > I will think about how to re-use the current fontconfig XML syntax,
> > and propose another XML syntax soon.
> > 
> > Feel free to comment it.
> > 
> > Thanks,
> >   Peng
> > 
> > _______________________________________________
> > Fontconfig mailing list
> > Fontconfig@xxxxxxxxxxxxxxxxxxxxx
> > https://lists.freedesktop.org/mailman/listinfo/fontconfig
> 
> 

_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/fontconfig




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

  Powered by Linux