<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>31931</bug_id>
          
          <creation_ts>2009-11-27 06:02:44 -0800</creation_ts>
          <short_desc>[Freetype] Don&apos;t use non-scalable fonts</short_desc>
          <delta_ts>2015-01-12 15:32:31 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKitGTK</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>PlatformOnly</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Duy Nguyen">pclouds</reporter>
          <assigned_to name="Carlos Alberto Lopez Perez">clopez</assigned_to>
          <cc>calvaris</cc>
    
    <cc>cgarcia</cc>
    
    <cc>clopez</cc>
    
    <cc>commit-queue</cc>
    
    <cc>darin</cc>
    
    <cc>gyuyoung.kim</cc>
    
    <cc>kling</cc>
    
    <cc>koivisto</cc>
    
    <cc>mmaxfield</cc>
    
    <cc>mrobinson</cc>
    
    <cc>svillar</cc>
    
    <cc>zecke</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>166883</commentid>
    <comment_count>0</comment_count>
    <who name="Duy Nguyen">pclouds</who>
    <bug_when>2009-11-27 06:02:44 -0800</bug_when>
    <thetext>Hi,

I don&apos;t know if this is WebKit bug or cairo/freetype. About a month ago, every time I surfed pages with CJK letters inside, CPU went up 100% for a while, then back to normal. Recently this happens more often even with pages that have no CJK letters. I ran with gdb and stopped the program a few times while CPU spiked and got this call trace

#0  0xb5af410b in pcf_load_font () from /usr/lib/libfreetype.so.6
#1  0xb5af55c7 in PCF_Face_Init () from /usr/lib/libfreetype.so.6
#2  0xb5aad6b5 in open_face () from /usr/lib/libfreetype.so.6
#3  0xb5aaefb9 in FT_Open_Face () from /usr/lib/libfreetype.so.6
#4  0xb5ab0e66 in FT_New_Face () from /usr/lib/libfreetype.so.6
#5  0xb5ee858b in cairo_ft_scaled_font_lock_face () from /usr/lib/libcairo.so.2
#6  0xb7b23c72 in WebCore::SimpleFontData::containsCharacters () from /home/pclouds/opt/webkit/lib/libwebkit-1.0.so.2
#7  0xb7af8948 in WebCore::FontCache::getFontDataForCharacters () from /home/pclouds/opt/webkit/lib/libwebkit-1.0.so.2
#8  0xb78322cb in WebCore::Font::glyphDataForCharacter () from /home/pclouds/opt/webkit/lib/libwebkit-1.0.so.2
#9  0xb78411bb in WebCore::WidthIterator::advance () from /home/pclouds/opt/webkit/lib/libwebkit-1.0.so.2
#10 0xb7831a60 in WebCore::Font::floatWidthForSimpleText () from /home/pclouds/opt/webkit/lib/libwebkit-1.0.so.2
#11 0xb782a99d in WebCore::Font::floatWidth () from /home/pclouds/opt/webkit/lib/libwebkit-1.0.so.2
#12 0xb78ab2ec in WebCore::RenderBlock::findNextLineBreak () from /home/pclouds/opt/webkit/lib/libwebkit-1.0.so.2
#13 0xb78ad6b7 in WebCore::RenderBlock::layoutInlineChildren () from /home/pclouds/opt/webkit/lib/libwebkit-1.0.so.2
#14 0xb789fd56 in WebCore::RenderBlock::layoutBlock () from /home/pclouds/opt/webkit/lib/libwebkit-1.0.so.2

OProfile said most of time was spent inside zlib, which was probably because all my pcf fonts were compressed.

I tested with WebKit r51413, cairo 1.8.8, freetype 2.3.11. An easy test is open yahoo.co.jp. My PCF fonts are baemuk-fonts, font-adobe-75dpi, font-cursor-misc, font-misc-misc, unifont (Gentoo package names). Any suggestions how to find out where the bottleneck is?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>166987</commentid>
    <comment_count>1</comment_count>
    <who name="Duy Nguyen">pclouds</who>
    <bug_when>2009-11-27 19:21:37 -0800</bug_when>
    <thetext>This is the list of fonts opened and number of open times (browsing yahoo.co.jp):

      1 open(&quot;/usr/share/fonts/corefonts/arialbd.ttf&quot;, O_RDONLY) = 19
     56 open(&quot;/usr/share/fonts/corefonts/arialbd.ttf&quot;, O_RDONLY) = 21
      1 open(&quot;/usr/share/fonts/corefonts/arialbd.ttf&quot;, O_RDONLY) = 26
      1 open(&quot;/usr/share/fonts/corefonts/arial.ttf&quot;, O_RDONLY) = 17
    355 open(&quot;/usr/share/fonts/corefonts/arial.ttf&quot;, O_RDONLY) = 21
     54 open(&quot;/usr/share/fonts/corefonts/courbd.ttf&quot;, O_RDONLY) = 21
    370 open(&quot;/usr/share/fonts/corefonts/couri.ttf&quot;, O_RDONLY) = 21
    329 open(&quot;/usr/share/fonts/corefonts/cour.ttf&quot;, O_RDONLY) = 21
    321 open(&quot;/usr/share/fonts/dejavu/DejaVuSans-BoldOblique.ttf&quot;, O_RDONLY) = 21
    347 open(&quot;/usr/share/fonts/dejavu/DejaVuSansMono-Bold.ttf&quot;, O_RDONLY) = 21
    369 open(&quot;/usr/share/fonts/dejavu/DejaVuSans.ttf&quot;, O_RDONLY) = 21
    323 open(&quot;/usr/share/fonts/dejavu/DejaVuSerif-Italic.ttf&quot;, O_RDONLY) = 21
    322 open(&quot;/usr/share/fonts/dejavu/DejaVuSerif.ttf&quot;, O_RDONLY) = 21
    356 open(&quot;/usr/share/fonts/freefont-ttf/FreeMono.ttf&quot;, O_RDONLY) = 21
    322 open(&quot;/usr/share/fonts/freefont-ttf/FreeSans.ttf&quot;, O_RDONLY) = 21
    390 open(&quot;/usr/share/fonts/freefont-ttf/FreeSerif.ttf&quot;, O_RDONLY) = 21
    389 open(&quot;/usr/share/fonts/misc/10x20.pcf.gz&quot;, O_RDONLY) = 21
    313 open(&quot;/usr/share/fonts/misc/12x13ja.pcf.gz&quot;, O_RDONLY) = 21
    358 open(&quot;/usr/share/fonts/misc/6x13.pcf.gz&quot;, O_RDONLY) = 21
    375 open(&quot;/usr/share/fonts/misc/9x15.pcf.gz&quot;, O_RDONLY) = 21
    328 open(&quot;/usr/share/fonts/misc/9x18.pcf.gz&quot;, O_RDONLY) = 21
    366 open(&quot;/usr/share/fonts/unifont/unifont-h.pcf.gz&quot;, O_RDONLY) = 21</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>171173</commentid>
    <comment_count>2</comment_count>
    <who name="Holger Freyther">zecke</who>
    <bug_when>2009-12-13 01:06:17 -0800</bug_when>
    <thetext>Could you find out who decides to open the pcf fonts? Specially how it decides to use the AxB.pcf.gz fonts? In WebCore/platform/graphics/gtk/FontPlatformDataGtk.cpp we are driving FontConfig... you could use FcPatternPrint on the pattern we put into fontconfig and get out of it to see what we are selecting.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>627989</commentid>
    <comment_count>3</comment_count>
    <who name="Martin Robinson">mrobinson</who>
    <bug_when>2012-05-18 13:30:08 -0700</bug_when>
    <thetext>Can you post a link to the page that has this issue?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>628340</commentid>
    <comment_count>4</comment_count>
    <who name="Duy Nguyen">pclouds</who>
    <bug_when>2012-05-18 20:20:27 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; Can you post a link to the page that has this issue?

http://www.yahoo.co.jp/ (not sure if it&apos;s still an issue as I&apos;m not using webkit browser right now)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>828664</commentid>
    <comment_count>5</comment_count>
    <who name="Martin Robinson">mrobinson</who>
    <bug_when>2013-02-08 10:20:33 -0800</bug_when>
    <thetext>It seems that non-scalable fonts just give us issues. We should instruct WebKitGTK+ to never select a non-scalable font.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1060680</commentid>
    <comment_count>6</comment_count>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2015-01-12 14:45:12 -0800</bug_when>
    <thetext>*** Bug 140290 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1060682</commentid>
    <comment_count>7</comment_count>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2015-01-12 14:47:42 -0800</bug_when>
    <thetext>I have uploaded a simple test case here where webkitgtk+ selects a non scalable font when ${etcfontconfig}/conf.d/70-no-bitmaps.conf is missing http://people.igalia.com/clopez/wkbug/140290/test.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1060695</commentid>
    <comment_count>8</comment_count>
      <attachid>244472</attachid>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2015-01-12 15:24:26 -0800</bug_when>
    <thetext>Created attachment 244472
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1060696</commentid>
    <comment_count>9</comment_count>
      <attachid>244472</attachid>
    <who name="Martin Robinson">mrobinson</who>
    <bug_when>2015-01-12 15:26:24 -0800</bug_when>
    <thetext>Comment on attachment 244472
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=244472&amp;action=review

&gt; Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp:169
&gt; +    // Always prefer scalable fonts. Otherwise we may end choosing fonts that look horrible.
&gt; +    FcPatternAddBool(pattern.get(), FC_SCALABLE, FcTrue);

A better comment might be, &quot;Never choose unscalable fonts, as they pixelate when displayed at different sizes.&quot; &quot;look horrible&quot; is a subjective statement. :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1060697</commentid>
    <comment_count>10</comment_count>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2015-01-12 15:32:31 -0800</bug_when>
    <thetext>Committed r178301: &lt;http://trac.webkit.org/changeset/178301&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>244472</attachid>
            <date>2015-01-12 15:24:26 -0800</date>
            <delta_ts>2015-01-12 15:26:24 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-31931-20150113002431.patch</filename>
            <type>text/plain</type>
            <size>1832</size>
            <attacher name="Carlos Alberto Lopez Perez">clopez</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMTc4MzAwCmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggN2YwMGQwYzg4OTAwZjMw
YjkyM2M1OTdjM2M0YTQ3ZDRjY2QwM2M5MC4uYTVhYTVlN2Q3Y2VkZmFmMTBjMGIwZjU2ZGIxYjFi
MWZkNDEwYzk1MiAxMDA2NDQKLS0tIGEvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCisrKyBiL1Nv
dXJjZS9XZWJDb3JlL0NoYW5nZUxvZwpAQCAtMSwzICsxLDE1IEBACisyMDE1LTAxLTEyICBDYXJs
b3MgQWxiZXJ0byBMb3BleiBQZXJleiAgPGNsb3BlekBpZ2FsaWEuY29tPgorCisgICAgICAgIFtG
cmVldHlwZV0gRG9uJ3QgdXNlIG5vbi1zY2FsYWJsZSBmb250cy4KKyAgICAgICAgaHR0cHM6Ly9i
dWdzLndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lkPTMxOTMxCisKKyAgICAgICAgUmV2aWV3ZWQg
YnkgTk9CT0RZIChPT1BTISkuCisKKyAgICAgICAgTm8gbmV3IHRlc3RzIG5lZWRlZC4KKworICAg
ICAgICAqIHBsYXRmb3JtL2dyYXBoaWNzL2ZyZWV0eXBlL0ZvbnRDYWNoZUZyZWVUeXBlLmNwcDoK
KyAgICAgICAgKFdlYkNvcmU6OkZvbnRDYWNoZTo6Y3JlYXRlRm9udFBsYXRmb3JtRGF0YSk6IFBy
ZWZlciBzY2FsYWJsZSBmb250cy4KKwogMj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YXR0ZXJuID0gYWRvcHRSZWYoRmNQYXR0ZXJuQ3JlYXRlKCkpOworICAgIC8vIEFsd2F5cyBwcmVm
ZXIgc2NhbGFibGUgZm9udHMuIE90aGVyd2lzZSB3ZSBtYXkgZW5kIGNob29zaW5nIGZvbnRzIHRo
YXQgbG9vayBob3JyaWJsZS4KKyAgICBGY1BhdHRlcm5BZGRCb29sKHBhdHRlcm4uZ2V0KCksIEZD
X1NDQUxBQkxFLCBGY1RydWUpOwogICAgIFN0cmluZyBmYW1pbHlOYW1lU3RyaW5nKGdldEZhbWls
eU5hbWVTdHJpbmdGcm9tRmFtaWx5KGZhbWlseSkpOwogICAgIGlmICghRmNQYXR0ZXJuQWRkU3Ry
aW5nKHBhdHRlcm4uZ2V0KCksIEZDX0ZBTUlMWSwgcmVpbnRlcnByZXRfY2FzdDxjb25zdCBGY0No
YXI4Kj4oZmFtaWx5TmFtZVN0cmluZy51dGY4KCkuZGF0YSgpKSkpCiAgICAgICAgIHJldHVybiBu
dWxscHRyOwo=
</data>
<flag name="review"
          id="269408"
          type_id="1"
          status="+"
          setter="mrobinson"
    />
    <flag name="commit-queue"
          id="269409"
          type_id="3"
          status="-"
          setter="mrobinson"
    />
          </attachment>
      

    </bug>

</bugzilla>