Rolled in patch by opendarwin.org@mitzpettel.com
authorggaren <ggaren@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Jul 2005 00:48:25 +0000 (00:48 +0000)
committerggaren <ggaren@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Jul 2005 00:48:25 +0000 (00:48 +0000)
        -fixes http://bugzilla.opendarwin.org/show_bug.cgi?id=3818
        Fallback font doesn't have requested weight in ATSUI-rendered text

        Reviewed by mjs.

        * WebCoreSupport.subproj/WebTextRenderer.m:
        (-[WebTextRenderer _createATSUTextLayoutForRun:style:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@9628 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/ChangeLog
WebKit/WebCoreSupport.subproj/WebTextRenderer.m

index 8661630e9ab5b1108af97b47c2ab4a02f957ce14..f25f5c2fcd7bcd63f9a55cfbdd1b1e4860ca024b 100644 (file)
@@ -1,3 +1,15 @@
+2005-07-08  Geoffrey Garen  <ggaren@apple.com>
+
+        Rolled in patch by opendarwin.org@mitzpettel.com
+
+        -fixes http://bugzilla.opendarwin.org/show_bug.cgi?id=3818
+        Fallback font doesn't have requested weight in ATSUI-rendered text
+
+        Reviewed by mjs.
+
+        * WebCoreSupport.subproj/WebTextRenderer.m:
+        (-[WebTextRenderer _createATSUTextLayoutForRun:style:]):
+
 2005-07-05  Adele Peterson  <adele@apple.com>
 
        Rolling out changes for <rdar://problem/3792529> REGRESSION (Mail): Tabs do not work the way they did in Panther (especially useful in plain text mail)
index 5d2369962bf10b7786594fec9a90fa6c3c7f8a0a..9e72ef034bffcd8c42579a1d009d1bb4809671c9 100644 (file)
@@ -1485,6 +1485,9 @@ static const char *joiningNames[] = {
 
     ATSUTextLayout layout;
     UniCharCount runLength;
+    ATSUFontID ATSUSubstituteFont;
+    UniCharArrayOffset substituteOffset;
+    UniCharCount substituteLength;
     OSStatus status;
     
     [self _initializeATSUStyle];
@@ -1521,6 +1524,20 @@ static const char *joiningNames[] = {
     status = ATSUSetTransientFontMatching (layout, YES);
     if(status != noErr)
         FATAL_ALWAYS ("ATSUSetTransientFontMatching failed(%d)", status);
+
+    substituteOffset = run->from;
+    while ((status = ATSUMatchFontsToText(layout, substituteOffset, kATSUToTextEnd, &ATSUSubstituteFont, &substituteOffset, &substituteLength)) == kATSUFontsMatched || status == kATSUFontsNotMatched) {
+        NSFont *substituteFont = [self _substituteFontForCharacters:run->characters+substituteOffset length:substituteLength families:style->families];
+        if (substituteFont) {
+            WebTextRenderer *substituteRenderer = [[WebTextRendererFactory sharedFactory] rendererWithFont:substituteFont usingPrinterFont:usingPrinterFont];
+            [substituteRenderer _initializeATSUStyle];
+            if (substituteRenderer && substituteRenderer->_ATSUSstyle)
+                ATSUSetRunStyle(layout, substituteRenderer->_ATSUSstyle, substituteOffset, substituteLength);
+            // ignoring errors
+        }
+        substituteOffset += substituteLength;
+    };
+    // ignoring errors in font substitution
         
     return layout;
 }