|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
FT_New_Face called many time for same font.Hi
I've been using Pango to render markup language, and one day when rendering a Chinese text (with a 8Mb font), I discovered that Pango seems to open the same font many times. Upon startup of my application the font is opened 5 times, and later 4 more times. The final output from the process' smap file is: 8184 kb 620 kb 0 kb /home/jln/git/eclipse/src/ juno/fonts/CODE2000.TTF 8184 kb 620 kb 0 kb /home/jln/git/eclipse/src/ juno/fonts/CODE2000.TTF 8184 kb 620 kb 0 kb /home/jln/git/eclipse/src/ juno/fonts/CODE2000.TTF 8184 kb 620 kb 0 kb /home/jln/git/eclipse/src/ juno/fonts/CODE2000.TTF 8184 kb 620 kb 0 kb /home/jln/git/eclipse/src/ juno/fonts/CODE2000.TTF 8184 kb 620 kb 0 kb /home/jln/git/eclipse/src/ juno/fonts/CODE2000.TTF 8184 kb 620 kb 0 kb /home/jln/git/eclipse/src/ juno/fonts/CODE2000.TTF 8184 kb 620 kb 0 kb /home/jln/git/eclipse/src/ juno/fonts/CODE2000.TTF 8184 kb 620 kb 0 kb /home/jln/git/eclipse/src/ juno/fonts/CODE2000.TTF The font is acquired by calling pango_fc_font_lock_face, which then calls FT_New_Face. I assume the font in turn should be free by calling pango_fc_font_unlock_face, however this function doesn't do anything. The proper call for unloading fonts "FT_Done_Face" is called by pango_ft2_font_finalize. However atleast my program doesn't seem to trigger this at any point. The goal of course is to use as little memory as possible, so what is supposed to call pango_ft2_font_finalize? Would other programs using Pango also open multiple instances of the same font? I will keep on digging, but any pointers greatly appreciated. I'm using Pango 1.20.5. -- Jesper L. Nielsen Senior Software Engineer @ 2M-Locatel _______________________________________________ gtk-i18n-list mailing list gtk-i18n-list@... http://mail.gnome.org/mailman/listinfo/gtk-i18n-list |
|
|
Re: FT_New_Face called many time for same font.First, try with pango 1.26.0. Second, which backend are you using? I assume
pangoft2. That's not really supported. We recommend using pangocairo only. behdad On 10/06/2009 05:12 AM, Jesper L. Nielsen wrote: > Hi > > I've been using Pango to render markup language, and one day when > rendering a Chinese text (with a 8Mb font), I discovered that Pango > seems to open the same font many times. > > Upon startup of my application the font is opened 5 times, and later 4 > more times. The final output from the process' smap file is: > > 8184 kb 620 kb 0 kb /home/jln/git/eclipse/src/juno/fonts/CODE2000.TTF > 8184 kb 620 kb 0 kb /home/jln/git/eclipse/src/juno/fonts/CODE2000.TTF > 8184 kb 620 kb 0 kb /home/jln/git/eclipse/src/juno/fonts/CODE2000.TTF > 8184 kb 620 kb 0 kb /home/jln/git/eclipse/src/juno/fonts/CODE2000.TTF > 8184 kb 620 kb 0 kb /home/jln/git/eclipse/src/juno/fonts/CODE2000.TTF > 8184 kb 620 kb 0 kb /home/jln/git/eclipse/src/juno/fonts/CODE2000.TTF > 8184 kb 620 kb 0 kb /home/jln/git/eclipse/src/juno/fonts/CODE2000.TTF > 8184 kb 620 kb 0 kb /home/jln/git/eclipse/src/juno/fonts/CODE2000.TTF > 8184 kb 620 kb 0 kb /home/jln/git/eclipse/src/juno/fonts/CODE2000.TTF > > The font is acquired by calling pango_fc_font_lock_face, which then > calls FT_New_Face. I assume the font in turn should be free by calling > pango_fc_font_unlock_face, however this function doesn't do anything. > > The proper call for unloading fonts "FT_Done_Face" is called by > pango_ft2_font_finalize. However atleast my program doesn't seem to > trigger this at any point. > > The goal of course is to use as little memory as possible, so what is > supposed to call pango_ft2_font_finalize? > Would other programs using Pango also open multiple instances of the > same font? > > I will keep on digging, but any pointers greatly appreciated. > > I'm using Pango 1.20.5. > > -- > Jesper L. Nielsen > Senior Software Engineer @ 2M-Locatel > > _______________________________________________ > gtk-i18n-list mailing list > gtk-i18n-list@... > http://mail.gnome.org/mailman/listinfo/gtk-i18n-list > gtk-i18n-list mailing list gtk-i18n-list@... http://mail.gnome.org/mailman/listinfo/gtk-i18n-list |
|
|
Re: FT_New_Face called many time for same font.On Oct 6, 2009, at 3:33 PM, Behdad Esfahbod wrote: > First, try with pango 1.26.0. Second, which backend are you using? > I assume pangoft2. That's not really supported. We recommend using > pangocairo only. > Hi Behdad. Ok, I'll go for Pango 1.26.0, and you assumption is correct, the backend is pangoft2. It seems that get_shaper_and_font_foreach decides to alter the PangoFont object, I haven't digged thoroughly into it yet, but would you assume some measures have been done in that direction? Also some very old postings on the internet suggests that PangoCairo is more than 50% slower than the PangoFT combination, I really hope that isn't the case.. -- Jesper L. Nielsen Senior Software Engineer @ 2M-Locatel _______________________________________________ gtk-i18n-list mailing list gtk-i18n-list@... http://mail.gnome.org/mailman/listinfo/gtk-i18n-list |
|
|
Re: FT_New_Face called many time for same font.On 10/06/2009 10:13 AM, Jesper L. Nielsen wrote:
> > On Oct 6, 2009, at 3:33 PM, Behdad Esfahbod wrote: > >> First, try with pango 1.26.0. Second, which backend are you using? I >> assume pangoft2. That's not really supported. We recommend using >> pangocairo only. >> > > Hi Behdad. > > Ok, I'll go for Pango 1.26.0, and you assumption is correct, the backend > is pangoft2. > > It seems that get_shaper_and_font_foreach decides to alter the PangoFont > object, I haven't digged thoroughly into it yet, but would you assume > some measures have been done in that direction? I'm not sure what that is, but pangocairo definitely doesn't have the problem you originally mentioned. > Also some very old postings on the internet suggests that PangoCairo is > more than 50% slower than the PangoFT combination, I really hope that > isn't the case.. As you said, those were very old postings. It's faster than anything else you find around now. behdad _______________________________________________ gtk-i18n-list mailing list gtk-i18n-list@... http://mail.gnome.org/mailman/listinfo/gtk-i18n-list |
|
|
Re: FT_New_Face called many time for same font.On Oct 6, 2009, at 4:15 PM, Behdad Esfahbod wrote: > > I'm not sure what that is, but pangocairo definitely doesn't have > the problem you originally mentioned. > You were absolutely right. I changed the backend and Cairo only loads a font once. I wish I had known that pangoft was broken before. I noticed that when building libpangoft2 is still linked however. I there a small dependency left? I've tried doing a ldd on Firefox (which uses PangoCairo too, right?) and Firefox alse links with libpangotft2. > > > As you said, those were very old postings. It's faster than > anything else you find around now. > I think I'm seeing a slight decrease in speed, but I have to investigate that. I am unsing the same method as the example 'cairoshape.c' coming with Pango is using. Maybe I could introduce a 'dirty' bit, and only layout the PangoLayout once instead of twice? -- Jesper L. Nielsen Senior Software Engineer @ 2M-Locatel _______________________________________________ gtk-i18n-list mailing list gtk-i18n-list@... http://mail.gnome.org/mailman/listinfo/gtk-i18n-list |
|
|
Re: FT_New_Face called many time for same font.On 10/13/2009 05:43 AM, Jesper L. Nielsen wrote:
> > On Oct 6, 2009, at 4:15 PM, Behdad Esfahbod wrote: >> >> I'm not sure what that is, but pangocairo definitely doesn't have the >> problem you originally mentioned. >> > > You were absolutely right. I changed the backend and Cairo only loads a > font once. I wish I had known that pangoft was broken before. I noticed > that when building libpangoft2 is still linked however. I there a small > dependency left? I've tried doing a ldd on Firefox (which uses > PangoCairo too, right?) and Firefox alse links with libpangotft2. libpangoft2.so provides two things: the pangoft2 backend (which is obsolete), and the pangofc abstract backend, that is also used by pangocairo. That's why it's still linked. >> As you said, those were very old postings. It's faster than anything >> else you find around now. >> > > I think I'm seeing a slight decrease in speed, but I have to investigate > that. I am unsing the same method as the example 'cairoshape.c' coming > with Pango is using. Maybe I could introduce a 'dirty' bit, and only > layout the PangoLayout once instead of twice? That should work. Let us know. behdad _______________________________________________ gtk-i18n-list mailing list gtk-i18n-list@... http://mail.gnome.org/mailman/listinfo/gtk-i18n-list |
| Free embeddable forum powered by Nabble | Forum Help |