<?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>50528</bug_id>
          
          <creation_ts>2010-12-04 15:01:38 -0800</creation_ts>
          <short_desc>SVG text smaller than 0.5px not displayed properly</short_desc>
          <delta_ts>2011-02-01 10:06:53 -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>SVG</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>12448</dup_id>
          
          <bug_file_loc>http://http://codedread.com/browser-tests/subpixel.svg</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Jeff Schiller">jeffschiller</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>krit</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>zimmermann</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>317315</commentid>
    <comment_count>0</comment_count>
    <who name="Jeff Schiller">jeffschiller</who>
    <bug_when>2010-12-04 15:01:38 -0800</bug_when>
    <thetext>http://codedread.com/browser-tests/subpixel.svg

or

&lt;svg xmlns=&apos;http://www.w3.org/2000/svg&apos;&gt;
  &lt;text x=&apos;10&apos; y=&apos;30&apos;&gt;The two words should be the same size:&lt;/text&gt;
  &lt;g transform=&apos;scale(15)&apos;&gt;
    &lt;text y=&apos;12&apos; style=&apos;font-size:0.5px&apos;&gt;TINY&lt;/text&gt;
    &lt;text y=&apos;24&apos; style=&apos;font-size:0.499999px&apos;&gt;TINY&lt;/text&gt;
  &lt;/g&gt;
&lt;/svg&gt;

Both words should be small on the page.  The latter one at font-size smaller than 0.5px is not displayed appropriately.

Also, you can see the effect more dramatically here: http://upload.wikimedia.org/wikipedia/commons/f/f9/PI.svg</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>317316</commentid>
    <comment_count>1</comment_count>
      <attachid>75617</attachid>
    <who name="Jeff Schiller">jeffschiller</who>
    <bug_when>2010-12-04 15:03:29 -0800</bug_when>
    <thetext>Created attachment 75617
Test case showing the problem</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>319322</commentid>
    <comment_count>2</comment_count>
    <who name="Nikolas Zimmermann">zimmermann</who>
    <bug_when>2010-12-09 01:13:05 -0800</bug_when>
    <thetext>Thanks for the testcase, Jeff!
I&apos;ve traced it down:

#1  0x0426c654 in WebCore::FontCache::createFontPlatformData (this=0x1a5965c0, fontDescription=@0x1d4adda0, family=@0x1d4adda0) at /Users/nikolaszimmermann/Coding/WebKit/WebCore/platform/graphics/mac/FontCacheMac.mm:214

(gdb) p fontDescription
$61 = (const class WebCore::FontDescription &amp;) @0x1d4adda0: {
  m_familyList = {
    m_family = {
      m_string = {
        m_impl = {
          &lt;WTF::FastAllocBase&gt; = {&lt;No data fields&gt;}, 
          members of WTF::RefPtr&lt;WTF::StringImpl&gt;: 
          m_ptr = 0x1a56e650
        }
      }
    }, 
    m_next = {
      &lt;WTF::RefPtr&lt;WebCore::SharedFontFamily&gt;&gt; = {
        &lt;WTF::FastAllocBase&gt; = {&lt;No data fields&gt;}, 
        members of WTF::RefPtr&lt;WebCore::SharedFontFamily&gt;: 
        m_ptr = 0x0
      }, &lt;No data fields&gt;}
  }, 
  m_specifiedSize = 0.49000001, 
  m_computedSize = 0.49000001, 

The font size is stored correctly in the FontDescription, but then &quot;computedPixelSize()&quot; is used to determine the actual font size.

193	
194	FontPlatformData* FontCache::createFontPlatformData(const FontDescription&amp; fontDescription, const AtomicString&amp; family)
195	{
196	    NSFontTraitMask traits = fontDescription.italic() ? NSFontItalicTrait : 0;
197	    NSInteger weight = toAppKitFontWeight(fontDescription.weight());
198	    float size = fontDescription.computedPixelSize();

(gdb) p size
$63 = 0

FontDescription.h:
    int computedPixelSize() const { return int(m_computedSize + 0.5f); }

This is the root of the problem. Just keeping my analysis here for the record.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>343123</commentid>
    <comment_count>3</comment_count>
    <who name="Nikolas Zimmermann">zimmermann</who>
    <bug_when>2011-02-01 04:02:52 -0800</bug_when>
    <thetext>The patch on bug 12448 fixes this problem. Thanks a lot for the testcase, I&apos;ve integrated it in my patch.

*** This bug has been marked as a duplicate of bug 12448 ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>343240</commentid>
    <comment_count>4</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2011-02-01 08:44:35 -0800</bug_when>
    <thetext>Is it really the same thing? In this testcase the text is just a line of pixels (even if it&apos;s not sharp). In Firefox, the text is much bigger.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>343278</commentid>
    <comment_count>5</comment_count>
    <who name="Nikolas Zimmermann">zimmermann</who>
    <bug_when>2011-02-01 09:49:33 -0800</bug_when>
    <thetext>(In reply to comment #4)
&gt; Is it really the same thing? In this testcase the text is just a line of pixels (even if it&apos;s not sharp). In Firefox, the text is much bigger.

Which testcase are you referring to?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>343287</commentid>
    <comment_count>6</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2011-02-01 10:00:07 -0800</bug_when>
    <thetext>One in a bug that I can&apos;t find right now, but was probably marked as a duplicate of this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>343291</commentid>
    <comment_count>7</comment_count>
    <who name="Dirk Schulze">krit</who>
    <bug_when>2011-02-01 10:03:20 -0800</bug_when>
    <thetext>I guess Simon thought about bug 52892.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>343295</commentid>
    <comment_count>8</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2011-02-01 10:06:53 -0800</bug_when>
    <thetext>Yep, that&apos;s the one. Sorry, I thought this was that bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>75617</attachid>
            <date>2010-12-04 15:03:29 -0800</date>
            <delta_ts>2010-12-04 15:03:29 -0800</delta_ts>
            <desc>Test case showing the problem</desc>
            <filename>subpixel.svg</filename>
            <type>image/svg+xml</type>
            <size>271</size>
            <attacher name="Jeff Schiller">jeffschiller</attacher>
            
              <data encoding="base64">PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnPgogIDx0ZXh0IHg9JzEwJyB5
PSczMCc+VGhlIHR3byB3b3JkcyBzaG91bGQgYmUgdGhlIHNhbWUgc2l6ZTo8L3RleHQ+CiAgPHRl
eHQgeD0nMTAnIHk9JzEyJyB0cmFuc2Zvcm09J3NjYWxlKDE1KSc+CiAgICA8dHNwYW4gc3R5bGU9
J2ZvbnQtc2l6ZTowLjVweCc+VElOWTwvdHNwYW4+CiAgICA8dHNwYW4gc3R5bGU9J2ZvbnQtc2l6
ZTowLjQ5OTk5OXB4Jz5USU5ZPC90c3Bhbj4KICA8L3RleHQ+Cjwvc3ZnPg==
</data>

          </attachment>
      

    </bug>

</bugzilla>