Huw Davies : gdi32/tests: tmLastChar is solely governed by the last entry before 0xffff in the cmap.

Alexandre Julliard julliard at winehq.org
Wed Jun 11 13:36:22 CDT 2014


Module: wine
Branch: master
Commit: 0987e77089880680ae9deb01f3b550bce43f0ac5
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0987e77089880680ae9deb01f3b550bce43f0ac5

Author: Huw Davies <huw at codeweavers.com>
Date:   Fri May 23 11:33:54 2014 +0100

gdi32/tests: tmLastChar is solely governed by the last entry before 0xffff in the cmap.

---

 dlls/gdi32/tests/font.c        |   40 ++++++++++++----------------------------
 dlls/gdi32/tests/wine_test.sfd |   39 +++++++++++++++++++--------------------
 dlls/gdi32/tests/wine_test.ttf |  Bin 1760 -> 1776 bytes
 3 files changed, 31 insertions(+), 48 deletions(-)

diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index 0e75088..e978166 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -3255,42 +3255,20 @@ static BOOL get_first_last_from_cmap4(void *ptr, DWORD *first, DWORD *last, DWOR
     int i;
     cmap_format_4 *cmap = (cmap_format_4*)ptr;
     USHORT seg_count = GET_BE_WORD(cmap->seg_countx2) / 2;
-    USHORT const *glyph_ids = cmap->end_count + 4 * seg_count + 1;
 
     *first = 0x10000;
 
     for(i = 0; i < seg_count; i++)
     {
-        DWORD code, index;
         cmap_format_4_seg seg;
 
         get_seg4(cmap, i, &seg);
-        for(code = seg.start_count; code <= seg.end_count; code++)
-        {
-            if(seg.id_range_offset == 0)
-                index = (seg.id_delta + code) & 0xffff;
-            else
-            {
-                index = seg.id_range_offset / 2
-                    + code - seg.start_count
-                    + i - seg_count;
 
-                /* some fonts have broken last segment */
-                if ((char *)(glyph_ids + index + 1) < (char *)ptr + limit)
-                    index = GET_BE_WORD(glyph_ids[index]);
-                else
-                {
-                    trace("segment %04x/%04x index %04x points to nowhere\n",
-                          seg.start_count, seg.end_count, index);
-                    index = 0;
-                }
-                if(index) index += seg.id_delta;
-            }
-            if(*first == 0x10000)
-                *last = *first = code;
-            else if(index)
-                *last = code;
-        }
+        if(seg.start_count > 0xfffe) break;
+
+        if(*first == 0x10000) *first = seg.start_count;
+
+        *last = min(seg.end_count, 0xfffe);
     }
 
     if(*first == 0x10000) return FALSE;
@@ -3560,7 +3538,7 @@ static void test_text_metrics(const LOGFONTA *lf, const NEWTEXTMETRICA *ntm)
         else
         {
             expect_first_W    = cmap_first;
-            expect_last_W     = min(cmap_last, os2_last_char);
+            expect_last_W     = cmap_last;
             if(os2_first_char <= 1)
                 expect_break_W = os2_first_char + 2;
             else if(os2_first_char > 0xff)
@@ -5064,6 +5042,7 @@ static void test_GetGlyphOutline_metric_clipping(void)
     HFONT hfont, hfont_prev;
     GLYPHMETRICS gm;
     TEXTMETRICA tm;
+    TEXTMETRICW tmW;
     DWORD ret;
 
     memset(&lf, 0, sizeof(lf));
@@ -5092,6 +5071,11 @@ static void test_GetGlyphOutline_metric_clipping(void)
         "Glyph bottom(%d) exceeds descent(%d)\n",
         gm.gmptGlyphOrigin.y - gm.gmBlackBoxY, -tm.tmDescent);
 
+    /* Test tmLastChar - wine_test has code points fffb-fffe mapped to glyph 0 */
+    GetTextMetricsW(hdc, &tmW);
+todo_wine
+    ok( tmW.tmLastChar == 0xfffe, "got %04x\n", tmW.tmLastChar);
+
     SelectObject(hdc, hfont_prev);
     DeleteObject(hfont);
     ReleaseDC(NULL, hdc);
diff --git a/dlls/gdi32/tests/wine_test.sfd b/dlls/gdi32/tests/wine_test.sfd
index 4c19377..c985b43 100644
--- a/dlls/gdi32/tests/wine_test.sfd
+++ b/dlls/gdi32/tests/wine_test.sfd
@@ -12,15 +12,13 @@ Ascent: 1638
 Descent: 410
 sfntRevision: 0x00010000
 LayerCount: 2
-Layer: 0 1 "Back"  1
-Layer: 1 1 "Fore"  0
+Layer: 0 1 "Back" 1
+Layer: 1 1 "Fore" 0
 XUID: [1021 905 592216984 1247726]
 FSType: 0
 OS2Version: 2
 OS2_WeightWidthSlopeOnly: 0
 OS2_UseTypoMetrics: 1
-CreationTime: 1288336343
-ModificationTime: 1366465321
 PfmFamily: 17
 TTFWeight: 500
 TTFWidth: 5
@@ -92,6 +90,7 @@ BeginChars: 65539 7
 
 StartChar: .notdef
 Encoding: 65536 -1 0
+AltUni2: 00fffe.ffffffff.0 00fffd.ffffffff.0 00fffc.ffffffff.0 00fffb.ffffffff.0
 Width: 748
 Flags: W
 TtInstrs:
@@ -212,14 +211,14 @@ Flags: WO
 LayerCount: 2
 Fore
 SplineSet
-459 1258 m 29,0,-1
- 462 1639 l 5,1,-1
- 389 1638 l 5,2,-1
- 492 1815 l 5,3,-1
- 609 1638.5 l 5,4,-1
- 531 1637.5 l 5,5,-1
- 523 1258 l 5,6,-1
- 459 1258 l 29,0,-1
+459 1258 m 25,0,-1
+ 462 1639 l 1,1,-1
+ 389 1638 l 1,2,-1
+ 492 1815 l 1,3,-1
+ 609 1638.5 l 1,4,-1
+ 531 1637.5 l 1,5,-1
+ 523 1258 l 1,6,-1
+ 459 1258 l 25,0,-1
 EndSplineSet
 EndChar
 
@@ -231,14 +230,14 @@ Flags: WO
 LayerCount: 2
 Fore
 SplineSet
-461 -30.7998 m 29,0,-1
- 464 -411.8 l 5,1,-1
- 391 -410.8 l 5,2,-1
- 494 -587.8 l 5,3,-1
- 611 -411.3 l 5,4,-1
- 533 -410.3 l 5,5,-1
- 525 -30.7998 l 5,6,-1
- 461 -30.7998 l 29,0,-1
+461 -30.7998 m 25,0,-1
+ 464 -411.8 l 1,1,-1
+ 391 -410.8 l 1,2,-1
+ 494 -587.8 l 1,3,-1
+ 611 -411.3 l 1,4,-1
+ 533 -410.3 l 1,5,-1
+ 525 -30.7998 l 1,6,-1
+ 461 -30.7998 l 25,0,-1
 EndSplineSet
 EndChar
 EndChars
diff --git a/dlls/gdi32/tests/wine_test.ttf b/dlls/gdi32/tests/wine_test.ttf
index 0868802..1562a32 100644
Binary files a/dlls/gdi32/tests/wine_test.ttf and b/dlls/gdi32/tests/wine_test.ttf differ




More information about the wine-cvs mailing list