Hi all, First, let me introduce myself. My name is Bob Kerr, and I''m investigating the possibility of involving fontconfig into VTK. It seems like this would be a good match, and there''s some good excitement on the vtk side for this. Now, I''ve got fontconfig 2.6.0 installed, and it seems that everything is working correctly, as far as I can tell. But, there doesn''t seem to be any way to get from where I am to where I want to go. I firmly believe that fontconfig is useful, and viable, and valuable, but I can''t find any type of documentation or tutorial or guide as to how to put fontconfig into my application. There''s the developers'' guide, which is just a list of functions and a brief description. There''s the users'' guide, which describe how to add fonts to fontconfig and then use an application that uses fontconfig. There''s some slides that Keith has posted (from years ago) about the reasons for fontconfig. But there''s nothing out there that tells me how to integrate it. After some lengthy searching, I''ve found a few items that make me somewhat concerned--requests for help from other people in my position, which have gone unanswered, both to this list and in other forums. I took the initiative to email one of those requestors, and they responded that they had received no help from the fontconfig community, and had decided that fontconfig wasn''t important for their application, since it looked to be too high of a cost to try to integrate it, since there was no help available. So, in a perhaps futile gesture, I''m asking once again if there is some sort of Newbie Guide to Integrating fontconfig into an Application. Or, failing that, is there an application that uses fontconfig and is well-structured, such that I can learn from it? Or, failing that, is there anyone in the fontconfig community that is willing to mentor someone? I realize that this is something that isn''t fun to do--the mentoring of new people, but if the goal of fontconfig is to provide a standard interface and mechanism for handling fonts across a wide variety of platforms and applications, then it behooves the community to provide some way to get more people using it, rather than just ignoring requests for guidance. Thanks in advance for any answers you might be able to provide. -- -bob Bad Performance Evaluations: "This employee is depriving a village somewhere of an idiot." ********************************************************************** * Robert Kerr, Member of the Cubit Mesh Generation Team * * and the Titan Informatics Toolkit Development Team * * rakerr at sandia.gov | PO Box 5800, MS 0376 * * Phone: (505) 844-8606 | Sandia National Labs * * Fax: (505) 284-0140 | Albuquerque, NM 87185-0376 * **********************************************************************
Hi, Robert, I don''t understand *why* you would want to integrate fontconfig into VTK. I assume that VTK only really needs access to high-level string layout functionality, such as that provided by the Pango, Pango+Cairo, or Pango+FreeType2 libraries. So why don''t you just go one of those routes and let Pango/FreeType deal with fontconfig under the hood somewhere? - Ed Trager On Wed, Jan 7, 2009 at 11:16 AM, Robert Kerr <rakerr at sandia.gov> wrote:> Hi all, > > First, let me introduce myself. My name is Bob Kerr, and I''m > investigating the possibility of involving fontconfig into VTK. It seems > like this would be a good match, and there''s some good excitement on the > vtk side for this. > > Now, I''ve got fontconfig 2.6.0 installed, and it seems that everything is > working correctly, as far as I can tell. But, there doesn''t seem to be > any way to get from where I am to where I want to go. I firmly believe > that fontconfig is useful, and viable, and valuable, but I can''t find any > type of documentation or tutorial or guide as to how to put fontconfig > into my application. There''s the developers'' guide, which is just a list > of functions and a brief description. There''s the users'' guide, which > describe how to add fonts to fontconfig and then use an application that > uses fontconfig. There''s some slides that Keith has posted (from years > ago) about the reasons for fontconfig. But there''s nothing out there that > tells me how to integrate it. > > After some lengthy searching, I''ve found a few items that make me somewhat > concerned--requests for help from other people in my position, which have > gone unanswered, both to this list and in other forums. I took the > initiative to email one of those requestors, and they responded that they > had received no help from the fontconfig community, and had decided that > fontconfig wasn''t important for their application, since it looked to be > too high of a cost to try to integrate it, since there was no help > available. > > So, in a perhaps futile gesture, I''m asking once again if there is some > sort of Newbie Guide to Integrating fontconfig into an Application. Or, > failing that, is there an application that uses fontconfig and is > well-structured, such that I can learn from it? Or, failing that, is > there anyone in the fontconfig community that is willing to mentor > someone? > > I realize that this is something that isn''t fun to do--the mentoring of > new people, but if the goal of fontconfig is to provide a standard > interface and mechanism for handling fonts across a wide variety of > platforms and applications, then it behooves the community to provide some > way to get more people using it, rather than just ignoring requests for > guidance. > > Thanks in advance for any answers you might be able to provide. > > -- > -bob > > Bad Performance Evaluations: "This employee is depriving a village > somewhere of an idiot." > ********************************************************************** > * Robert Kerr, Member of the Cubit Mesh Generation Team * > * and the Titan Informatics Toolkit Development Team * > * rakerr at sandia.gov | PO Box 5800, MS 0376 * > * Phone: (505) 844-8606 | Sandia National Labs * > * Fax: (505) 284-0140 | Albuquerque, NM 87185-0376 * > ********************************************************************** > > _______________________________________________ > Fontconfig mailing list > Fontconfig at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/fontconfig >
Ed, Thanks for the response. I appreciate your input. So, my situation is that I''m rather new to the team, and was given this assignment by someone else, and it was suggested that I look into putting fontconfig into the project. If pango et al already handle what we need, then that drastically reduces the issues I have to deal with. It would be a case of the person giving me the assignment not having any experience in font issues, and not knowing what route to take for this. I''ll certainly look more into what pango/cairo provide, in the hopes that it''ll prove a better avenue of exploration. Thanks again! -bob On Wed, 7 Jan 2009, Ed Trager wrote:> Hi, Robert, > > I don''t understand *why* you would want to integrate fontconfig into > VTK. I assume that VTK only really needs access to high-level string > layout functionality, such as that provided by the Pango, Pango+Cairo, > or Pango+FreeType2 libraries. So why don''t you just go one of those > routes and let Pango/FreeType deal with fontconfig under the hood > somewhere? > > - Ed Trager > > On Wed, Jan 7, 2009 at 11:16 AM, Robert Kerr <rakerr at sandia.gov> wrote: >> Hi all, >> >> First, let me introduce myself. My name is Bob Kerr, and I''m >> investigating the possibility of involving fontconfig into VTK. It seems >> like this would be a good match, and there''s some good excitement on the >> vtk side for this. >> >> Now, I''ve got fontconfig 2.6.0 installed, and it seems that everything is >> working correctly, as far as I can tell. But, there doesn''t seem to be >> any way to get from where I am to where I want to go. I firmly believe >> that fontconfig is useful, and viable, and valuable, but I can''t find any >> type of documentation or tutorial or guide as to how to put fontconfig >> into my application. There''s the developers'' guide, which is just a list >> of functions and a brief description. There''s the users'' guide, which >> describe how to add fonts to fontconfig and then use an application that >> uses fontconfig. There''s some slides that Keith has posted (from years >> ago) about the reasons for fontconfig. But there''s nothing out there that >> tells me how to integrate it. >> >> After some lengthy searching, I''ve found a few items that make me somewhat >> concerned--requests for help from other people in my position, which have >> gone unanswered, both to this list and in other forums. I took the >> initiative to email one of those requestors, and they responded that they >> had received no help from the fontconfig community, and had decided that >> fontconfig wasn''t important for their application, since it looked to be >> too high of a cost to try to integrate it, since there was no help >> available. >> >> So, in a perhaps futile gesture, I''m asking once again if there is some >> sort of Newbie Guide to Integrating fontconfig into an Application. Or, >> failing that, is there an application that uses fontconfig and is >> well-structured, such that I can learn from it? Or, failing that, is >> there anyone in the fontconfig community that is willing to mentor >> someone? >> >> I realize that this is something that isn''t fun to do--the mentoring of >> new people, but if the goal of fontconfig is to provide a standard >> interface and mechanism for handling fonts across a wide variety of >> platforms and applications, then it behooves the community to provide some >> way to get more people using it, rather than just ignoring requests for >> guidance. >> >> Thanks in advance for any answers you might be able to provide. >> >> -- >> -bob >> >> Bad Performance Evaluations: "This employee is depriving a village >> somewhere of an idiot." >> ********************************************************************** >> * Robert Kerr, Member of the Cubit Mesh Generation Team * >> * and the Titan Informatics Toolkit Development Team * >> * rakerr at sandia.gov | PO Box 5800, MS 0376 * >> * Phone: (505) 844-8606 | Sandia National Labs * >> * Fax: (505) 284-0140 | Albuquerque, NM 87185-0376 * >> ********************************************************************** >> >> _______________________________________________ >> Fontconfig mailing list >> Fontconfig at lists.freedesktop.org >> http://lists.freedesktop.org/mailman/listinfo/fontconfig >> > >-- -bob For their vows, Ginny suggests--at least eighty percent facetiously-- that they go with, "Well, I still don''t like anyone else better than you." ********************************************************************** * Robert Kerr, Member of the Cubit Mesh Generation Team * * and the Titan Informatics Toolkit Development Team * * rakerr at sandia.gov | PO Box 5800, MS 0376 * * Phone: (505) 844-8606 | Sandia National Labs * * Fax: (505) 284-0140 | Albuquerque, NM 87185-0376 * **********************************************************************
Behdad Esfahbod
2009-Jan-07 22:55 UTC
[Fontconfig] Tutorial or guidance for using fontconfig
Hi Robert, I agree with Ed that you should highly consider using pangocairo (pangoft2 would do it too, but is not developed anymore). Now, you probably will see some resistance as this will introduce a few new dependencies. But that''s really the only way to bring full internationalization to your toolkit. If you still decide to use fontconfig directly, I always reply to messages that are to the point. True, there is no good guide to read. But if you ask smart questions (like, "I have a family name, how do I find the best font file to use?"), you get smart answers. If you ask stupid questions ("how do I use fontconfig?"), you probably don''t get any answers. Cheers, behdad Robert Kerr wrote:> Ed, > Thanks for the response. I appreciate your input. > > So, my situation is that I''m rather new to the team, and was given this > assignment by someone else, and it was suggested that I look into putting > fontconfig into the project. If pango et al already handle what we need, > then that drastically reduces the issues I have to deal with. It would be > a case of the person giving me the assignment not having any experience in > font issues, and not knowing what route to take for this. > > I''ll certainly look more into what pango/cairo provide, in the hopes that > it''ll prove a better avenue of exploration. > > Thanks again! > > -bob > > > On Wed, 7 Jan 2009, Ed Trager wrote: > >> Hi, Robert, >> >> I don''t understand *why* you would want to integrate fontconfig into >> VTK. I assume that VTK only really needs access to high-level string >> layout functionality, such as that provided by the Pango, Pango+Cairo, >> or Pango+FreeType2 libraries. So why don''t you just go one of those >> routes and let Pango/FreeType deal with fontconfig under the hood >> somewhere? >> >> - Ed Trager >> >> On Wed, Jan 7, 2009 at 11:16 AM, Robert Kerr <rakerr at sandia.gov> wrote: >>> Hi all, >>> >>> First, let me introduce myself. My name is Bob Kerr, and I''m >>> investigating the possibility of involving fontconfig into VTK. It seems >>> like this would be a good match, and there''s some good excitement on the >>> vtk side for this. >>> >>> Now, I''ve got fontconfig 2.6.0 installed, and it seems that everything is >>> working correctly, as far as I can tell. But, there doesn''t seem to be >>> any way to get from where I am to where I want to go. I firmly believe >>> that fontconfig is useful, and viable, and valuable, but I can''t find any >>> type of documentation or tutorial or guide as to how to put fontconfig >>> into my application. There''s the developers'' guide, which is just a list >>> of functions and a brief description. There''s the users'' guide, which >>> describe how to add fonts to fontconfig and then use an application that >>> uses fontconfig. There''s some slides that Keith has posted (from years >>> ago) about the reasons for fontconfig. But there''s nothing out there that >>> tells me how to integrate it. >>> >>> After some lengthy searching, I''ve found a few items that make me somewhat >>> concerned--requests for help from other people in my position, which have >>> gone unanswered, both to this list and in other forums. I took the >>> initiative to email one of those requestors, and they responded that they >>> had received no help from the fontconfig community, and had decided that >>> fontconfig wasn''t important for their application, since it looked to be >>> too high of a cost to try to integrate it, since there was no help >>> available. >>> >>> So, in a perhaps futile gesture, I''m asking once again if there is some >>> sort of Newbie Guide to Integrating fontconfig into an Application. Or, >>> failing that, is there an application that uses fontconfig and is >>> well-structured, such that I can learn from it? Or, failing that, is >>> there anyone in the fontconfig community that is willing to mentor >>> someone? >>> >>> I realize that this is something that isn''t fun to do--the mentoring of >>> new people, but if the goal of fontconfig is to provide a standard >>> interface and mechanism for handling fonts across a wide variety of >>> platforms and applications, then it behooves the community to provide some >>> way to get more people using it, rather than just ignoring requests for >>> guidance. >>> >>> Thanks in advance for any answers you might be able to provide. >>> >>> -- >>> -bob >>> >>> Bad Performance Evaluations: "This employee is depriving a village >>> somewhere of an idiot." >>> ********************************************************************** >>> * Robert Kerr, Member of the Cubit Mesh Generation Team * >>> * and the Titan Informatics Toolkit Development Team * >>> * rakerr at sandia.gov | PO Box 5800, MS 0376 * >>> * Phone: (505) 844-8606 | Sandia National Labs * >>> * Fax: (505) 284-0140 | Albuquerque, NM 87185-0376 * >>> ********************************************************************** >>> >>> _______________________________________________ >>> Fontconfig mailing list >>> Fontconfig at lists.freedesktop.org >>> http://lists.freedesktop.org/mailman/listinfo/fontconfig >>> >> >
Staffan Gimåker
2009-Jan-07 23:45 UTC
[Fontconfig] Tutorial or guidance for using fontconfig
On Wednesday 07 January 2009 23:55:45 Behdad Esfahbod wrote:> If you still decide to use fontconfig directly, I always reply to messages > that are to the point. True, there is no good guide to read. But if you > ask smart questions (like, "I have a family name, how do I find the best > font file to use?"), you get smart answers. If you ask stupid questions > ("how do I use fontconfig?"), you probably don''t get any answers.So, if I have a family name (say, Times), how *do I* find the best font file to use (as in, the path to the font)? (We use OpenGL to render (polygonal) text in 3D so, AFAICT, going through Pango seems a bit redundant for our usage.) Cheers, Staffan -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part. Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20090108/d633fe4a/attachment.pgp
Behdad Esfahbod
2009-Jan-07 23:59 UTC
[Fontconfig] Tutorial or guidance for using fontconfig
Staffan Gim?ker wrote:> On Wednesday 07 January 2009 23:55:45 Behdad Esfahbod wrote: >> If you still decide to use fontconfig directly, I always reply to messages >> that are to the point. True, there is no good guide to read. But if you >> ask smart questions (like, "I have a family name, how do I find the best >> font file to use?"), you get smart answers. If you ask stupid questions >> ("how do I use fontconfig?"), you probably don''t get any answers. > > So, if I have a family name (say, Times), how *do I* find the best font file to > use (as in, the path to the font)?Check the man pages for exact parameters and error handling, but something like this: FcPattern *pat, *match; FcResult result; char *file; int index; pat = FcPatternCreate (); FcPatternAddString (pat, FC_FAMILY, "Times"); FcConfigSubstitute (NULL, pat, FcMatchPattern); FcDefaultSubstitute (pat); match = FcFontMatch (NULL, pat, &result); FcPatternGetString (match, FC_FILE, 0, (FcChar8 **) &file); FcPatternGetInteger (match, FC_INDEX, 0, &index); If you use FreeType, at this point you can do: FT_New_Face (ftlib, file, id, &face); to get your face. Then you can clean up: FcPatternDestroy (match); FcPatternDestroy (pat);> (We use OpenGL to render (polygonal) text in 3D so, AFAICT, going through > Pango seems a bit redundant for our usage.)Going through Pango gets you internationalization. That is, correct rendering of Arabic, Hebrew, Indic, Thai, etc etc etc. There are a few projects using Pango with OpenGL. Search the net. Cheers, behdad> Cheers, > Staffan
Jesper L. Nielsen
2009-Jan-08 08:34 UTC
[Fontconfig] Tutorial or guidance for using fontconfig
On Jan 7, 2009, at 5:16 PM, Robert Kerr wrote:> After some lengthy searching, I''ve found a few items that make me > somewhat > concerned--requests for help from other people in my position, which > have > gone unanswered, both to this list and in other forums. I took the > initiative to email one of those requestors, and they responded that > they > had received no help from the fontconfig community, and had decided > that > fontconfig wasn''t important for their application, since it looked > to be > too high of a cost to try to integrate it, since there was no help > available. >Hi Robert. I haven''t been very active on this list, but I do recognise some of your concerns, and I wanted to share my experience with Pango/ Fontconfig/Freetype. My goal was to implement Pango on an embedded system in order to display foreign languages. I already had Freetype implemented, so the Pango/Fontconfig/Freetype solution seemed like an easy way to go. However as you already found out Fontconfig really doesn''t have no documentation really, and the community around Fontconfig is non existent (or not to be found). I have had help from Keith Packard, who is the main developer of Fontconfig, but he is a busy man. Anyway, I did my research the hard way: Looking through a lot of source code :) The conclusion I have now reached is that Fontconfig is not designed for embedded system (no one claimed it would be though) because it''s way to CPU intensive when searching for fonts to use (basically, the Font Family to real font-file transition). At the moment I''m looking at taking out Fontconfig from Pango, but unfortunately their are tightly bound together in the Pango sourcecode. After reading the replies to your email, I''m wondering if Cairo would be the right way to go for me to? Anyway I don''t know much about VTK besides what I could Google. However I think Fontconfig is best used on Desktop system, where the user would like to change between a lot of fonts, and deals with many different resolutions. Hope you can use the feedback, and I''ll be happy to share further Fontconfig findings with you :) -- Jesper L. Nielsen Senior Software Engineer @ 2M-Locatel
Behdad Esfahbod
2009-Jan-08 08:59 UTC
[Fontconfig] Tutorial or guidance for using fontconfig
Jesper L. Nielsen wrote:> On Jan 7, 2009, at 5:16 PM, Robert Kerr wrote:[...]> Anyway, I did my research the hard way: Looking through a lot of > source code :) The conclusion I have now reached is that Fontconfig is > not designed for embedded system (no one claimed it would be though) > because it''s way to CPU intensive when searching for fonts to use > (basically, the Font Family to real font-file transition).Do you have any numbers? If you don''t have many fonts, it can''t be slow. And I''m working on making it much faster as we speak.> At the > moment I''m looking at taking out Fontconfig from Pango, but > unfortunately their are tightly bound together in the Pango sourcecode.That makes little sense.> After reading the replies to your email, I''m wondering if Cairo would > be the right way to go for me to?Cairo doesn''t do any internationalization. It buys you nothing, text-wise. And it requires fontconfig still.> Anyway I don''t know much about VTK besides what I could Google. > However I think Fontconfig is best used on Desktop system, where the > user would like to change between a lot of fonts, and deals with many > different resolutions.I disagree. Fontconfig is in use on many embedded systems already.> Hope you can use the feedback, and I''ll be happy to share further > Fontconfig findings with you :)behdad
Jesper L. Nielsen
2009-Jan-08 09:46 UTC
[Fontconfig] Tutorial or guidance for using fontconfig
Hi Behdad and that for the reply. On Jan 8, 2009, at 9:59 AM, Behdad Esfahbod wrote:> Jesper L. Nielsen wrote: >> On Jan 7, 2009, at 5:16 PM, Robert Kerr wrote: > [...] >> Anyway, I did my research the hard way: Looking through a lot of >> source code :) The conclusion I have now reached is that Fontconfig >> is >> not designed for embedded system (no one claimed it would be though) >> because it''s way to CPU intensive when searching for fonts to use >> (basically, the Font Family to real font-file transition). > > Do you have any numbers? If you don''t have many fonts, it can''t be > slow. > And I''m working on making it much faster as we speak. >First, keep in mind that I am using this on an embedded system, so there are limitations. I do have a various number of fonts for different languages and other things, so the first performance hit is when fontconfig builds it''s cache on startup, if there is a way to disable this, I haven''t found it. I have been running sysprof and the majority of time spend while rendering fonts seems to be in fontconfig. I don''t know how to dump Sysprof output to text, so I''ve attached a screendump.>> At the >> moment I''m looking at taking out Fontconfig from Pango, but >> unfortunately their are tightly bound together in the Pango >> sourcecode. > > That makes little sense.I''ve been looking at the Pango 1.22 code, and seperating the *ft2*.c files from the *fc*.c files is difficult becuase the ft2 files contain direct references for structures within FontConfig. A quick grep: $ grep Fc pangoft2.c | wc -l 43 So what I mean is that there a references to FcPattern, PangoFcFont and other things defined in the Fontconfig specific source files. So taking out just the Fontconfig part for the pangoft2.c would require some work.> >> After reading the replies to your email, I''m wondering if Cairo would >> be the right way to go for me to? > > Cairo doesn''t do any internationalization. It buys you nothing, > text-wise. > And it requires fontconfig still.Ok, that''s good to know. I was hoping to get rid of Fontconfig by jumping to Cairo, no use in trying that then :)> > >> Anyway I don''t know much about VTK besides what I could Google. >> However I think Fontconfig is best used on Desktop system, where the >> user would like to change between a lot of fonts, and deals with many >> different resolutions. > > I disagree. Fontconfig is in use on many embedded systems already.I''m sorry but then I must have misunderstood something or done something wrong. Could you point me towards any embedded systems using Fontconfig? I''m not trying to pin FontConfig to the wall, I might be using it in a very wrong way :-) Have a nice day. Jesper -------------- next part -------------- A non-text attachment was scrubbed... Name: sysprof.png Type: image/png Size: 60586 bytes Desc: not available Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20090108/5d685461/attachment-0001.png
>>>>> "Jesper" == Jesper L Nielsen <jln at locatel.dk> writes:Jesper> I do have a various number of fonts for different languages and other Jesper> things, so the first performance hit is when fontconfig builds it''s Jesper> cache on startup, if there is a way to disable this, I haven''t found it. Ideally, the cache should be built as part of generating the firmware image, not at runtime. If the user can add fonts, they should go into a directory just for such fonts (much like a workstation user''s ~/.fonts directory). Only adding or removing fonts from that dir would cause new caching, and only of fonts in that dir. If the user cannot add or remove fonts, then the cache can be in "rom". The easy way to generate the cache would be to use real hardware or a simulator, but fc''s src is easy enough to read that modifying it to write an app which runs on one platform and creates cache files for a target platform should be straight forward. That would allow you to create the cache files as part of your normal firmware build process. You don''t need to disable the cache, you need to generate it once, ahead of time, and let your product use it. -JimC -- James Cloos <cloos at jhcloos.com> OpenPGP: 1024D/ED7DAEA6
Jesper L. Nielsen
2009-Jan-08 19:22 UTC
[Fontconfig] Tutorial or guidance for using fontconfig
On Jan 8, 2009, at 7:29 PM, James Cloos wrote:>>>>>> "Jesper" == Jesper L Nielsen <jln at locatel.dk> writes: > > Jesper> I do have a various number of fonts for different languages > and other > Jesper> things, so the first performance hit is when fontconfig > builds it''s > Jesper> cache on startup, if there is a way to disable this, I > haven''t found it. > > Ideally, the cache should be built as part of generating the firmware > image, not at runtime. > > If the user can add fonts, they should go into a directory just for > such > fonts (much like a workstation user''s ~/.fonts directory). Only > adding > or removing fonts from that dir would cause new caching, and only of > fonts in that dir. > > If the user cannot add or remove fonts, then the cache can be in > "rom".Currently all fonts are located on a main server, hosted using NFS. The directory on the server can be modified with new fonts by a 3rd party as he pleases, however I could probably instruct this person to do a rebuild of the cache file, which would solve the startup problem. Looking beside creating the cache by forehand, Pango still introduced quite a speed penalty when going from pure Freetype to Pango. And judging from my attachment in my previous mail, about 50% of the time is spent in FontConfig selecting and loading the correct font. But really, the part of Pango that FontConfig provides is superfluous to my project, I really just need to render a certain text (be it any kind of language) with a given font-file, and not a font family. But really, I hope someone might be able to explain why FontConfig takes so long (screendump, previous mail).. Thanks.. Jesper
Behdad Esfahbod
2009-Jan-08 21:48 UTC
[Fontconfig] Tutorial or guidance for using fontconfig
Jesper L. Nielsen wrote:> I do have a various number of fonts for different languages and other > things, so the first performance hit is when fontconfig builds it''s > cache on startup, if there is a way to disable this, I haven''t found it.Sure, building caches is slow. The first question is why is it building the cache on each startup.> I have been running sysprof and the majority of time spend while > rendering fonts seems to be in fontconfig. > > I don''t know how to dump Sysprof output to text, so I''ve attached a > screendump.The screenshot shows nothing really. The fontconfig functions you are showing in the shot are taking only 3% of the total time.>>> At the >>> moment I''m looking at taking out Fontconfig from Pango, but >>> unfortunately their are tightly bound together in the Pango sourcecode. >> >> That makes little sense. > > I''ve been looking at the Pango 1.22 code, and seperating the *ft2*.c > files from the *fc*.c files is difficult becuase the ft2 files contain > direct references for structures within FontConfig. > > A quick grep: > > $ grep Fc pangoft2.c | wc -l > 43 > > So what I mean is that there a references to FcPattern, PangoFcFont and > other things defined in the Fontconfig specific source files. So taking > out just the Fontconfig part for the pangoft2.c would require some work.pantoft2 subclasses pangofc. So, you are pretty much talking about writing a new pango backend. And then, the pango shapers also depend on pangofc. So you have to modify those too. Really, your fighting the wrong battle. Just focus on getting fontconfig working for you. behdad
Jesper L. Nielsen
2009-Jan-09 10:06 UTC
[Fontconfig] Tutorial or guidance for using fontconfig
> Jesper L. Nielsen wrote: > >> I do have a various number of fonts for different languages and other >> things, so the first performance hit is when fontconfig builds it''s >> cache on startup, if there is a way to disable this, I haven''t >> found it. > > Sure, building caches is slow. The first question is why is it > building the > cache on each startup. >Because it is on an embedded system and no place to save the caching database after each reboot. However I can work past that using some NFS trickery.>> I have been running sysprof and the majority of time spend while >> rendering fonts seems to be in fontconfig. >> >> I don''t know how to dump Sysprof output to text, so I''ve attached a >> screendump. > > The screenshot shows nothing really. The fontconfig functions you > are showing > in the shot are taking only 3% of the total time. >True, I''ll get some better numbers on the embedded system soon. But the screenshot only shows a simple test program I produced to profile the pango calls. So the times should be regarded as relativ, and kernel time used disregarded.>> So what I mean is that there a references to FcPattern, PangoFcFont >> and >> other things defined in the Fontconfig specific source files. So >> taking >> out just the Fontconfig part for the pangoft2.c would require some >> work. > > pantoft2 subclasses pangofc. So, you are pretty much talking about > writing a > new pango backend. And then, the pango shapers also depend on > pangofc. So > you have to modify those too. Really, your fighting the wrong > battle. Just > focus on getting fontconfig working for you. >I was mustering myself to write a whole new backend, but if the shaper also uses FontConfig, I think I''ll better give FontConfig another shot. Jesper
On Wed, 7 Jan 2009, Behdad Esfahbod wrote:> Hi Robert, > > I agree with Ed that you should highly consider using pangocairo (pangoft2 > would do it too, but is not developed anymore). Now, you probably will see > some resistance as this will introduce a few new dependencies. But that''s > really the only way to bring full internationalization to your toolkit.Well, since Pango/cairo are already linked in, perhaps the dependency issue won''t be horrible.> > If you still decide to use fontconfig directly, I always reply to messages > that are to the point. True, there is no good guide to read. But if you ask > smart questions (like, "I have a family name, how do I find the best font file > to use?"), you get smart answers. If you ask stupid questions ("how do I use > fontconfig?"), you probably don''t get any answers. >I can understand your position, but this still points out a problem--i.e. how does a new developer learn enough to ask smart questions? For example, your suggested "smart question" is something that I wouldn''t be able to even think about for awhile. So really, the question that I was trying to ask was "How do I get started?" and is the question that there really isn''t anything available to find an answer fore. That being said, I''m incredibly grateful to everyone on the list who''s been so helpful--I was full of trepidation that I''d be either ignored, or flamed into a pile of cinders, but you all have been very helpful. Thanks again -bob> Cheers, > behdad > > Robert Kerr wrote: >> Ed, >> Thanks for the response. I appreciate your input. >> >> So, my situation is that I''m rather new to the team, and was given this >> assignment by someone else, and it was suggested that I look into putting >> fontconfig into the project. If pango et al already handle what we need, >> then that drastically reduces the issues I have to deal with. It would be >> a case of the person giving me the assignment not having any experience in >> font issues, and not knowing what route to take for this. >> >> I''ll certainly look more into what pango/cairo provide, in the hopes that >> it''ll prove a better avenue of exploration. >> >> Thanks again! >> >> -bob >> >> >> On Wed, 7 Jan 2009, Ed Trager wrote: >> >>> Hi, Robert, >>> >>> I don''t understand *why* you would want to integrate fontconfig into >>> VTK. I assume that VTK only really needs access to high-level string >>> layout functionality, such as that provided by the Pango, Pango+Cairo, >>> or Pango+FreeType2 libraries. So why don''t you just go one of those >>> routes and let Pango/FreeType deal with fontconfig under the hood >>> somewhere? >>> >>> - Ed Trager >>> >>> On Wed, Jan 7, 2009 at 11:16 AM, Robert Kerr <rakerr at sandia.gov> wrote: >>>> Hi all, >>>> >>>> First, let me introduce myself. My name is Bob Kerr, and I''m >>>> investigating the possibility of involving fontconfig into VTK. It seems >>>> like this would be a good match, and there''s some good excitement on the >>>> vtk side for this. >>>> >>>> Now, I''ve got fontconfig 2.6.0 installed, and it seems that everything is >>>> working correctly, as far as I can tell. But, there doesn''t seem to be >>>> any way to get from where I am to where I want to go. I firmly believe >>>> that fontconfig is useful, and viable, and valuable, but I can''t find any >>>> type of documentation or tutorial or guide as to how to put fontconfig >>>> into my application. There''s the developers'' guide, which is just a list >>>> of functions and a brief description. There''s the users'' guide, which >>>> describe how to add fonts to fontconfig and then use an application that >>>> uses fontconfig. There''s some slides that Keith has posted (from years >>>> ago) about the reasons for fontconfig. But there''s nothing out there that >>>> tells me how to integrate it. >>>> >>>> After some lengthy searching, I''ve found a few items that make me somewhat >>>> concerned--requests for help from other people in my position, which have >>>> gone unanswered, both to this list and in other forums. I took the >>>> initiative to email one of those requestors, and they responded that they >>>> had received no help from the fontconfig community, and had decided that >>>> fontconfig wasn''t important for their application, since it looked to be >>>> too high of a cost to try to integrate it, since there was no help >>>> available. >>>> >>>> So, in a perhaps futile gesture, I''m asking once again if there is some >>>> sort of Newbie Guide to Integrating fontconfig into an Application. Or, >>>> failing that, is there an application that uses fontconfig and is >>>> well-structured, such that I can learn from it? Or, failing that, is >>>> there anyone in the fontconfig community that is willing to mentor >>>> someone? >>>> >>>> I realize that this is something that isn''t fun to do--the mentoring of >>>> new people, but if the goal of fontconfig is to provide a standard >>>> interface and mechanism for handling fonts across a wide variety of >>>> platforms and applications, then it behooves the community to provide some >>>> way to get more people using it, rather than just ignoring requests for >>>> guidance. >>>> >>>> Thanks in advance for any answers you might be able to provide. >>>> >>>> -- >>>> -bob >>>> >>>> Bad Performance Evaluations: "This employee is depriving a village >>>> somewhere of an idiot." >>>> ********************************************************************** >>>> * Robert Kerr, Member of the Cubit Mesh Generation Team * >>>> * and the Titan Informatics Toolkit Development Team * >>>> * rakerr at sandia.gov | PO Box 5800, MS 0376 * >>>> * Phone: (505) 844-8606 | Sandia National Labs * >>>> * Fax: (505) 284-0140 | Albuquerque, NM 87185-0376 * >>>> ********************************************************************** >>>> >>>> _______________________________________________ >>>> Fontconfig mailing list >>>> Fontconfig at lists.freedesktop.org >>>> http://lists.freedesktop.org/mailman/listinfo/fontconfig >>>> >>> >> > >-- -bob That''s as secure as taping a $100 to the floor of a football stadium bathroom for safekeeping. ********************************************************************** * Robert Kerr, Member of the Cubit Mesh Generation Team * * and the Titan Informatics Toolkit Development Team * * rakerr at sandia.gov | PO Box 5800, MS 0376 * * Phone: (505) 844-8606 | Sandia National Labs * * Fax: (505) 284-0140 | Albuquerque, NM 87185-0376 * **********************************************************************
Behdad Esfahbod
2009-Jan-09 20:00 UTC
[Fontconfig] Tutorial or guidance for using fontconfig
Robert Kerr wrote:> On Wed, 7 Jan 2009, Behdad Esfahbod wrote: > >> Hi Robert, >> >> I agree with Ed that you should highly consider using pangocairo >> (pangoft2 >> would do it too, but is not developed anymore). Now, you probably >> will see >> some resistance as this will introduce a few new dependencies. But >> that''s >> really the only way to bring full internationalization to your toolkit. > > Well, since Pango/cairo are already linked in, perhaps the dependency > issue won''t be horrible.Ah, makes a lot of sense then. It may be a bit more work though.>> If you still decide to use fontconfig directly, I always reply to >> messages >> that are to the point. True, there is no good guide to read. But if >> you ask >> smart questions (like, "I have a family name, how do I find the best >> font file >> to use?"), you get smart answers. If you ask stupid questions ("how >> do I use >> fontconfig?"), you probably don''t get any answers. >> > > I can understand your position, but this still points out a > problem--i.e. how does a new developer learn enough to ask smart > questions? For example, your suggested "smart question" is something > that I wouldn''t be able to even think about for awhile. So really, the > question that I was trying to ask was "How do I get started?" and is the > question that there really isn''t anything available to find an answer fore.Interesting.> That being said, I''m incredibly grateful to everyone on the list who''s > been so helpful--I was full of trepidation that I''d be either ignored, > or flamed into a pile of cinders, but you all have been very helpful.Well, we''re no weirdos, just your typical free software developers. From my experience over the past couple of years, most of the requests that go unanswered are typically asking for 1) more documentation, or 2) help porting ABC to embedded platform XYZ. The former goes unanswered because what''s out there is all there is available, and the latter goes unanswered because no one on the list has any idea what the XYZ platform is or what issues the requester is facing. Cheers, behdad> Thanks again > > -bob > > >> Cheers, >> behdad >> >> Robert Kerr wrote: >>> Ed, >>> Thanks for the response. I appreciate your input. >>> >>> So, my situation is that I''m rather new to the team, and was given this >>> assignment by someone else, and it was suggested that I look into >>> putting >>> fontconfig into the project. If pango et al already handle what we >>> need, >>> then that drastically reduces the issues I have to deal with. It >>> would be >>> a case of the person giving me the assignment not having any >>> experience in >>> font issues, and not knowing what route to take for this. >>> >>> I''ll certainly look more into what pango/cairo provide, in the hopes >>> that >>> it''ll prove a better avenue of exploration. >>> >>> Thanks again! >>> >>> -bob >>> >>> >>> On Wed, 7 Jan 2009, Ed Trager wrote: >>> >>>> Hi, Robert, >>>> >>>> I don''t understand *why* you would want to integrate fontconfig into >>>> VTK. I assume that VTK only really needs access to high-level string >>>> layout functionality, such as that provided by the Pango, Pango+Cairo, >>>> or Pango+FreeType2 libraries. So why don''t you just go one of those >>>> routes and let Pango/FreeType deal with fontconfig under the hood >>>> somewhere? >>>> >>>> - Ed Trager >>>> >>>> On Wed, Jan 7, 2009 at 11:16 AM, Robert Kerr <rakerr at sandia.gov> wrote: >>>>> Hi all, >>>>> >>>>> First, let me introduce myself. My name is Bob Kerr, and I''m >>>>> investigating the possibility of involving fontconfig into VTK. It >>>>> seems >>>>> like this would be a good match, and there''s some good excitement >>>>> on the >>>>> vtk side for this. >>>>> >>>>> Now, I''ve got fontconfig 2.6.0 installed, and it seems that >>>>> everything is >>>>> working correctly, as far as I can tell. But, there doesn''t seem >>>>> to be >>>>> any way to get from where I am to where I want to go. I firmly >>>>> believe >>>>> that fontconfig is useful, and viable, and valuable, but I can''t >>>>> find any >>>>> type of documentation or tutorial or guide as to how to put fontconfig >>>>> into my application. There''s the developers'' guide, which is just >>>>> a list >>>>> of functions and a brief description. There''s the users'' guide, which >>>>> describe how to add fonts to fontconfig and then use an application >>>>> that >>>>> uses fontconfig. There''s some slides that Keith has posted (from >>>>> years >>>>> ago) about the reasons for fontconfig. But there''s nothing out >>>>> there that >>>>> tells me how to integrate it. >>>>> >>>>> After some lengthy searching, I''ve found a few items that make me >>>>> somewhat >>>>> concerned--requests for help from other people in my position, >>>>> which have >>>>> gone unanswered, both to this list and in other forums. I took the >>>>> initiative to email one of those requestors, and they responded >>>>> that they >>>>> had received no help from the fontconfig community, and had decided >>>>> that >>>>> fontconfig wasn''t important for their application, since it looked >>>>> to be >>>>> too high of a cost to try to integrate it, since there was no help >>>>> available. >>>>> >>>>> So, in a perhaps futile gesture, I''m asking once again if there is >>>>> some >>>>> sort of Newbie Guide to Integrating fontconfig into an >>>>> Application. Or, >>>>> failing that, is there an application that uses fontconfig and is >>>>> well-structured, such that I can learn from it? Or, failing that, is >>>>> there anyone in the fontconfig community that is willing to mentor >>>>> someone? >>>>> >>>>> I realize that this is something that isn''t fun to do--the >>>>> mentoring of >>>>> new people, but if the goal of fontconfig is to provide a standard >>>>> interface and mechanism for handling fonts across a wide variety of >>>>> platforms and applications, then it behooves the community to >>>>> provide some >>>>> way to get more people using it, rather than just ignoring requests >>>>> for >>>>> guidance. >>>>> >>>>> Thanks in advance for any answers you might be able to provide. >>>>> >>>>> -- >>>>> -bob >>>>> >>>>> Bad Performance Evaluations: "This employee is depriving a village >>>>> somewhere of an idiot." >>>>> ********************************************************************** >>>>> * Robert Kerr, Member of the Cubit Mesh Generation Team * >>>>> * and the Titan Informatics Toolkit Development Team * >>>>> * rakerr at sandia.gov | PO Box 5800, MS 0376 * >>>>> * Phone: (505) 844-8606 | Sandia National Labs * >>>>> * Fax: (505) 284-0140 | Albuquerque, NM 87185-0376 * >>>>> ********************************************************************** >>>>> >>>>> _______________________________________________ >>>>> Fontconfig mailing list >>>>> Fontconfig at lists.freedesktop.org >>>>> http://lists.freedesktop.org/mailman/listinfo/fontconfig >>>>> >>>> >>> >> >> >
On Fri, 9 Jan 2009, Behdad Esfahbod wrote:> Robert Kerr wrote: >> On Wed, 7 Jan 2009, Behdad Esfahbod wrote: >> >>> Hi Robert, >>> >>> I agree with Ed that you should highly consider using pangocairo >>> (pangoft2 >>> would do it too, but is not developed anymore). Now, you probably >>> will see >>> some resistance as this will introduce a few new dependencies. But >>> that''s >>> really the only way to bring full internationalization to your toolkit. >> >> Well, since Pango/cairo are already linked in, perhaps the dependency >> issue won''t be horrible. > > Ah, makes a lot of sense then. It may be a bit more work though. > > >>> If you still decide to use fontconfig directly, I always reply to >>> messages >>> that are to the point. True, there is no good guide to read. But if >>> you ask >>> smart questions (like, "I have a family name, how do I find the best >>> font file >>> to use?"), you get smart answers. If you ask stupid questions ("how >>> do I use >>> fontconfig?"), you probably don''t get any answers. >>> >> >> I can understand your position, but this still points out a >> problem--i.e. how does a new developer learn enough to ask smart >> questions? For example, your suggested "smart question" is something >> that I wouldn''t be able to even think about for awhile. So really, the >> question that I was trying to ask was "How do I get started?" and is the >> question that there really isn''t anything available to find an answer fore. > > Interesting. > >> That being said, I''m incredibly grateful to everyone on the list who''s >> been so helpful--I was full of trepidation that I''d be either ignored, >> or flamed into a pile of cinders, but you all have been very helpful. > > Well, we''re no weirdos, just your typical free software developers. From my > experience over the past couple of years, most of the requests that go > unanswered are typically asking for 1) more documentation, or 2) help porting > ABC to embedded platform XYZ. The former goes unanswered because what''s out > there is all there is available, and the latter goes unanswered because no one > on the list has any idea what the XYZ platform is or what issues the requester > is facing. > > > Cheers, > behdad >Certainly makes sense. Although, I know that I have LOADS of free time to just sit around and play, so I can''t see why it should be different for anyone else! I mean, don''t we all have scads of extra time to write up tutorials and examples? Oh, wait, sorry--that''s my other life, in bizzaro-world. thanks -bob> >> Thanks again >> >> -bob >> >> >>> Cheers, >>> behdad >>> >>> Robert Kerr wrote: >>>> Ed, >>>> Thanks for the response. I appreciate your input. >>>> >>>> So, my situation is that I''m rather new to the team, and was given this >>>> assignment by someone else, and it was suggested that I look into >>>> putting >>>> fontconfig into the project. If pango et al already handle what we >>>> need, >>>> then that drastically reduces the issues I have to deal with. It >>>> would be >>>> a case of the person giving me the assignment not having any >>>> experience in >>>> font issues, and not knowing what route to take for this. >>>> >>>> I''ll certainly look more into what pango/cairo provide, in the hopes >>>> that >>>> it''ll prove a better avenue of exploration. >>>> >>>> Thanks again! >>>> >>>> -bob >>>> >>>> >>>> On Wed, 7 Jan 2009, Ed Trager wrote: >>>> >>>>> Hi, Robert, >>>>> >>>>> I don''t understand *why* you would want to integrate fontconfig into >>>>> VTK. I assume that VTK only really needs access to high-level string >>>>> layout functionality, such as that provided by the Pango, Pango+Cairo, >>>>> or Pango+FreeType2 libraries. So why don''t you just go one of those >>>>> routes and let Pango/FreeType deal with fontconfig under the hood >>>>> somewhere? >>>>> >>>>> - Ed Trager >>>>> >>>>> On Wed, Jan 7, 2009 at 11:16 AM, Robert Kerr <rakerr at sandia.gov> wrote: >>>>>> Hi all, >>>>>> >>>>>> First, let me introduce myself. My name is Bob Kerr, and I''m >>>>>> investigating the possibility of involving fontconfig into VTK. It >>>>>> seems >>>>>> like this would be a good match, and there''s some good excitement >>>>>> on the >>>>>> vtk side for this. >>>>>> >>>>>> Now, I''ve got fontconfig 2.6.0 installed, and it seems that >>>>>> everything is >>>>>> working correctly, as far as I can tell. But, there doesn''t seem >>>>>> to be >>>>>> any way to get from where I am to where I want to go. I firmly >>>>>> believe >>>>>> that fontconfig is useful, and viable, and valuable, but I can''t >>>>>> find any >>>>>> type of documentation or tutorial or guide as to how to put fontconfig >>>>>> into my application. There''s the developers'' guide, which is just >>>>>> a list >>>>>> of functions and a brief description. There''s the users'' guide, which >>>>>> describe how to add fonts to fontconfig and then use an application >>>>>> that >>>>>> uses fontconfig. There''s some slides that Keith has posted (from >>>>>> years >>>>>> ago) about the reasons for fontconfig. But there''s nothing out >>>>>> there that >>>>>> tells me how to integrate it. >>>>>> >>>>>> After some lengthy searching, I''ve found a few items that make me >>>>>> somewhat >>>>>> concerned--requests for help from other people in my position, >>>>>> which have >>>>>> gone unanswered, both to this list and in other forums. I took the >>>>>> initiative to email one of those requestors, and they responded >>>>>> that they >>>>>> had received no help from the fontconfig community, and had decided >>>>>> that >>>>>> fontconfig wasn''t important for their application, since it looked >>>>>> to be >>>>>> too high of a cost to try to integrate it, since there was no help >>>>>> available. >>>>>> >>>>>> So, in a perhaps futile gesture, I''m asking once again if there is >>>>>> some >>>>>> sort of Newbie Guide to Integrating fontconfig into an >>>>>> Application. Or, >>>>>> failing that, is there an application that uses fontconfig and is >>>>>> well-structured, such that I can learn from it? Or, failing that, is >>>>>> there anyone in the fontconfig community that is willing to mentor >>>>>> someone? >>>>>> >>>>>> I realize that this is something that isn''t fun to do--the >>>>>> mentoring of >>>>>> new people, but if the goal of fontconfig is to provide a standard >>>>>> interface and mechanism for handling fonts across a wide variety of >>>>>> platforms and applications, then it behooves the community to >>>>>> provide some >>>>>> way to get more people using it, rather than just ignoring requests >>>>>> for >>>>>> guidance. >>>>>> >>>>>> Thanks in advance for any answers you might be able to provide. >>>>>> >>>>>> -- >>>>>> -bob >>>>>> >>>>>> Bad Performance Evaluations: "This employee is depriving a village >>>>>> somewhere of an idiot." >>>>>> ********************************************************************** >>>>>> * Robert Kerr, Member of the Cubit Mesh Generation Team * >>>>>> * and the Titan Informatics Toolkit Development Team * >>>>>> * rakerr at sandia.gov | PO Box 5800, MS 0376 * >>>>>> * Phone: (505) 844-8606 | Sandia National Labs * >>>>>> * Fax: (505) 284-0140 | Albuquerque, NM 87185-0376 * >>>>>> ********************************************************************** >>>>>> >>>>>> _______________________________________________ >>>>>> Fontconfig mailing list >>>>>> Fontconfig at lists.freedesktop.org >>>>>> http://lists.freedesktop.org/mailman/listinfo/fontconfig >>>>>> >>>>> >>>> >>> >>> >> > >-- -bob That''s as secure as taping a $100 to the floor of a football stadium bathroom for safekeeping. ********************************************************************** * Robert Kerr, Member of the Cubit Mesh Generation Team * * and the Titan Informatics Toolkit Development Team * * rakerr at sandia.gov | PO Box 5800, MS 0376 * * Phone: (505) 844-8606 | Sandia National Labs * * Fax: (505) 284-0140 | Albuquerque, NM 87185-0376 * **********************************************************************
Jesper L. Nielsen
2009-Jan-15 10:02 UTC
[Fontconfig] Tutorial or guidance for using fontconfig
Hi Behdad and list.. After poking around, using gprof and other things I found a reason for spending all the time in Fontconfig. I was calling pango_ft2_font_map_new() for every object I wanted to draw, and apparently this function can be reused throughout my application. Now I''m looking at sharing the fontconfig-cache on NFS, and as each embedded devices share the same NFS mount, this should be simple however I have some questions for the format. 1: Since the NFS mount is mounted as read/write, the first embedded system that boots will create the cache. Does the building of cache have a lock mechanism, or might this be a race condition? 2: It seems the fontcache leaves a file for every font used as it runs, and that the filenames have a hostname appended to them? If this is true, would it at all be possible to generate a fontconfig-cache on the NFS server, if the embedded system doesn''t share the same hostname? Wouldn''t this just generate a whole bunch of files for each embedded device? 3: Is the format of the cache files platform independent? Hope I can get some pointers now that I''ve regained my faith in FontConfig :) All the best. Jesper On Jan 9, 2009, at 11:06 AM, Jesper L. Nielsen wrote:>> >> Sure, building caches is slow. The first question is why is it >> building the >> cache on each startup. >> > > Because it is on an embedded system and no place to save the caching > database after each reboot. However I can work past that using some > NFS trickery. > >>> I have been running sysprof and the majority of time spend while >>> rendering fonts seems to be in fontconfig. >>> >>> I don''t know how to dump Sysprof output to text, so I''ve attached a >>> screendump. >> >> The screenshot shows nothing really. The fontconfig functions you >> are showing >> in the shot are taking only 3% of the total time. >> > > True, I''ll get some better numbers on the embedded system soon. But > the screenshot only shows a simple test program I produced to > profile the pango calls. So the times should be regarded as relativ, > and kernel time used disregarded. >>> So what I mean is that there a references to FcPattern, >>> PangoFcFont and >>> other things defined in the Fontconfig specific source files. So >>> taking >>> out just the Fontconfig part for the pangoft2.c would require some >>> work. >> >> pantoft2 subclasses pangofc. So, you are pretty much talking about >> writing a >> new pango backend. And then, the pango shapers also depend on >> pangofc. So >> you have to modify those too. Really, your fighting the wrong >> battle. Just >> focus on getting fontconfig working for you. >> > I was mustering myself to write a whole new backend, but if the > shaper also uses FontConfig, I think I''ll better give FontConfig > another shot. > > Jesper
Behdad Esfahbod
2009-Jan-15 16:41 UTC
[Fontconfig] Tutorial or guidance for using fontconfig
Jesper L. Nielsen wrote:> > Hi Behdad and list..Hi,> After poking around, using gprof and other things I found a reason for > spending all the time in Fontconfig. I was calling > pango_ft2_font_map_new() for every object I wanted to draw, and > apparently this function can be reused throughout my application. > > Now I''m looking at sharing the fontconfig-cache on NFS, and as each > embedded devices share the same NFS mount, this should be simple however > I have some questions for the format. > > 1: Since the NFS mount is mounted as read/write, the first embedded > system that boots will create the cache. Does the building of cache have > a lock mechanism, or might this be a race condition?It uses directory locks. So, as long as mkdir is atomic on your NFS server and clients, you should be fine.> 2: It seems the fontcache leaves a file for every font used as it runs, > and that the filenames have a hostname appended to them? If this is > true, would it at all be possible to generate a fontconfig-cache on the > NFS server, if the embedded system doesn''t share the same hostname? > Wouldn''t this just generate a whole bunch of files for each embedded > device?Humm? Got sample? Which version? Fontconfig creates one cache file per font *directory*. And only appends the architecture tag to the name.> 3: Is the format of the cache files platform independent?No, but the architecture tag is part of the cache file name, so it should all work. behdad> Hope I can get some pointers now that I''ve regained my faith in > FontConfig :) > > All the best. > Jesper > > On Jan 9, 2009, at 11:06 AM, Jesper L. Nielsen wrote: >>> >>> Sure, building caches is slow. The first question is why is it >>> building the >>> cache on each startup. >>> >> >> Because it is on an embedded system and no place to save the caching >> database after each reboot. However I can work past that using some >> NFS trickery. >> >>>> I have been running sysprof and the majority of time spend while >>>> rendering fonts seems to be in fontconfig. >>>> >>>> I don''t know how to dump Sysprof output to text, so I''ve attached a >>>> screendump. >>> >>> The screenshot shows nothing really. The fontconfig functions you >>> are showing >>> in the shot are taking only 3% of the total time. >>> >> >> True, I''ll get some better numbers on the embedded system soon. But >> the screenshot only shows a simple test program I produced to profile >> the pango calls. So the times should be regarded as relativ, and >> kernel time used disregarded. >>>> So what I mean is that there a references to FcPattern, PangoFcFont and >>>> other things defined in the Fontconfig specific source files. So taking >>>> out just the Fontconfig part for the pangoft2.c would require some >>>> work. >>> >>> pantoft2 subclasses pangofc. So, you are pretty much talking about >>> writing a >>> new pango backend. And then, the pango shapers also depend on >>> pangofc. So >>> you have to modify those too. Really, your fighting the wrong >>> battle. Just >>> focus on getting fontconfig working for you. >>> >> I was mustering myself to write a whole new backend, but if the shaper >> also uses FontConfig, I think I''ll better give FontConfig another shot. >> >> Jesper > >
Keith Packard
2009-Jan-15 16:49 UTC
[Fontconfig] Tutorial or guidance for using fontconfig
On Thu, 2009-01-15 at 11:02 +0100, Jesper L.Nielsen wrote:> 1: Since the NFS mount is mounted as read/write, the first embedded > system that boots will create the cache. Does the building of cache > have a lock mechanism, or might this be a race condition?It has a locking mechanism which should be proof against even NFS semantics.> 2: It seems the fontcache leaves a file for every font used as it > runs, and that the filenames have a hostname appended to them? If this > is true, would it at all be possible to generate a fontconfig-cache on > the NFS server, if the embedded system doesn''t share the same > hostname? Wouldn''t this just generate a whole bunch of files for each > embedded device?One per directory, not one per font. And, the file names have a ''platform'' name embedded in them, not a host name.> 3: Is the format of the cache files platform independent?No, they are binary files which depend on the byte order and padding used by the C compiler. Normally I wouldn''t do this, but fontconfig mmap''s the files and uses their contents directly to reduce memory usage and startup time. -- keith.packard at intel.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20090115/52532328/attachment.pgp