<?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>4759</bug_id>
          
          <creation_ts>2005-08-30 11:59:19 -0700</creation_ts>
          <short_desc>&apos;ex&apos; length unit calculation (Some layout tests fail if the system primary language is Russian)</short_desc>
          <delta_ts>2006-01-09 02:11:58 -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>Layout and Rendering</component>
          <version>420+</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.4</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>HasReduction</keywords>
          <priority>P3</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Alexey Proskuryakov">ap</reporter>
          <assigned_to name="Alexey Proskuryakov">ap</assigned_to>
          <cc>mitz</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>17941</commentid>
    <comment_count>0</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2005-08-30 11:59:19 -0700</bug_when>
    <thetext>Steps to reproduce:

1. Set the system primary lnguage to Russian (in International control panel); re-login
2. Run layout tests

Results: five of them fail:
css1/font_properties/font_size
css1/text_properties/line_height
css1/text_properties/text_indent
css1/units/length_units
fast/lists/008

Discussion: all these tests use lengths specified in ex units. Apparently, these are calculated incorrectly 
in some cases. I have traced this up to CSSPrimitiveValueImpl::computeLengthFloat(), which gives 
different results for different primary languages.

For example, length_units.html uses ex values for two font sizes, with factor values of 7.66406 and 
19.1602 (primary English). However, with primary Russian these become 7 and 18.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>17947</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2005-08-30 13:10:48 -0700</bug_when>
    <thetext>Apparently, it&apos;s [font glyphWithName:@&quot;x&quot;] that fails (in [WebTextRenderer xHeight]) for primary Russian. 
Many thanks to Mitz Pettel for guiding to this result!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>17994</commentid>
    <comment_count>2</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2005-08-30 22:23:29 -0700</bug_when>
    <thetext>  Interestingly, the following reduced test fails for English primary language, too (also, see the thread at 
&lt;http://www.cocoabuilder.com/archive/message/cocoa/2005/6/1/137649&gt;). There&apos;s something in 
WebKit that makes fontWithName work, at least for some languages...

int main (int argc, const char * argv[]) 
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    NSFont *font = [NSFont fontWithName:@&quot;Times-Roman&quot; size:12];
    NSLog(@&quot;Font: %@&quot;, [font description]);
	
    NSGlyph xGlyph = [font glyphWithName:@&quot;x&quot;];
    NSLog(@&quot;x glyph: %d&quot;, xGlyph);
	
    [pool release];
    return 0;
}
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26950</commentid>
    <comment_count>3</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2005-12-28 01:17:49 -0800</bug_when>
    <thetext>I would encourage alexey or mitz to take a stab at a patch here, as most of us don&apos;t live on a non-english 
system day-to-day.  Wonderful reduction, btw.  It would be even better if we could create a layout test to 
show this (that would not require any specific system language setting).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>27003</commentid>
    <comment_count>4</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2005-12-28 04:19:35 -0800</bug_when>
    <thetext>I approached this several times, but couldn&apos;t find a solution. Other ways of measuring width or 
advancement give different results, and I don&apos;t see any other way to find a glyph (other than the failing 
glyphWithName). I&apos;m not a Cocoa expert, though.

Judging from comments and cvs log, this is a pretty sensitive area, so the results for Roman systems 
should probably be preserved exactly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>27986</commentid>
    <comment_count>5</comment_count>
      <attachid>5544</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2006-01-08 07:38:26 -0800</bug_when>
    <thetext>Created attachment 5544
proposed patch

Fallback to glyphForCharacter() if -[NSFont glyphWithName] has failed.

(Sorry for a not quite canonical form of the patch, the repository is
inaccessible at the moment)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>28036</commentid>
    <comment_count>6</comment_count>
      <attachid>5544</attachid>
    <who name="Maciej Stachowiak">mjs</who>
    <bug_when>2006-01-09 01:57:58 -0800</bug_when>
    <thetext>Comment on attachment 5544
proposed patch

you could coneider using only the new way to get the x glyph, if it works for
all languages.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>28037</commentid>
    <comment_count>7</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2006-01-09 02:11:58 -0800</bug_when>
    <thetext>Landed with glyphForCharacter() being used always, not just as a fallback (discussed with Maciej on IRC).</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>5544</attachid>
            <date>2006-01-08 07:38:26 -0800</date>
            <delta_ts>2006-01-09 01:57:58 -0800</delta_ts>
            <desc>proposed patch</desc>
            <filename>4759.txt</filename>
            <type>text/plain</type>
            <size>1216</size>
            <attacher name="Alexey Proskuryakov">ap</attacher>
            
              <data encoding="base64">LS0tIFdlYlRleHRSZW5kZXJlci5tCTIwMDYtMDEtMDggMTg6Mjg6MTIuMDAwMDAwMDAwICswMzAw
CisrKyBXZWJUZXh0UmVuZGVyZXItbmV3Lm0JMjAwNi0wMS0wOCAxODozMTozOC4wMDAwMDAwMDAg
KzAzMDAKQEAgLTEyOCw2ICsxMjgsNyBAQAogC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ZXJlckZhY3Rvcnkgc2hhcmVkRmFjdG9yeV0gcmVuZGVyZXJX
aXRoRm9udDpmb250XTsKKyAgICAgICAgeEdseXBoID0gZ2x5cGhGb3JDaGFyYWN0ZXIoJnJlbmRl
cmVyLCAneCcpOworICAgIH0KKyAgICAKICAgICBpZiAoeEdseXBoKSB7CiAgICAgICAgIE5TUmVj
dCB4Qm94ID0gW2ZvbnQuZm9udCBib3VuZGluZ1JlY3RGb3JHbHlwaDp4R2x5cGhdOwogICAgICAg
ICAvLyBVc2UgdGhlIG1heGltdW0gb2YgZWl0aGVyIHdpZHRoIG9yIGhlaWdodCBiZWNhdXNlICJ4
IiBpcyBuZWFybHkgc3F1YXJlCg==
</data>
<flag name="review"
          id="1212"
          type_id="1"
          status="+"
          setter="mjs"
    />
          </attachment>
      

    </bug>

</bugzilla>