Contents of /trunk/mozilla-firefox/patches/mozilla-firefox-1.0.7-pango-rounding.patch
Parent Directory | Revision Log
Revision 153 -
(show annotations)
(download)
Tue May 8 20:52:56 2007 UTC (17 years, 4 months ago) by niro
File size: 2853 byte(s)
Tue May 8 20:52:56 2007 UTC (17 years, 4 months ago) by niro
File size: 2853 byte(s)
-import
1 | --- mozilla/gfx/src/gtk/nsFontMetricsPango.cpp.foo 2005-03-21 17:09:14.000000000 -0500 |
2 | +++ mozilla/gfx/src/gtk/nsFontMetricsPango.cpp 2005-03-21 17:16:53.000000000 -0500 |
3 | @@ -501,13 +501,11 @@ |
4 | |
5 | pango_layout_get_size(layout, &width, &height); |
6 | |
7 | - width /= PANGO_SCALE; |
8 | - |
9 | g_object_unref(layout); |
10 | |
11 | float f; |
12 | f = mDeviceContext->DevUnitsToAppUnits(); |
13 | - aWidth = NSToCoordRound(width * f); |
14 | + aWidth = NSToCoordRound(width * f / PANGO_SCALE); |
15 | |
16 | // printf("GetWidth (char *) %d\n", aWidth); |
17 | |
18 | @@ -541,11 +539,9 @@ |
19 | FixupSpaceWidths(layout, text); |
20 | pango_layout_get_size(layout, &width, &height); |
21 | |
22 | - width /= PANGO_SCALE; |
23 | - |
24 | float f; |
25 | f = mDeviceContext->DevUnitsToAppUnits(); |
26 | - aWidth = NSToCoordRound(width * f); |
27 | + aWidth = NSToCoordRound(width * f / PANGO_SCALE); |
28 | |
29 | // printf("GetWidth %d\n", aWidth); |
30 | |
31 | @@ -601,9 +597,9 @@ |
32 | float P2T; |
33 | P2T = mDeviceContext->DevUnitsToAppUnits(); |
34 | |
35 | - aDimensions.width = NSToCoordRound(rect.width / PANGO_SCALE * P2T); |
36 | - aDimensions.ascent = NSToCoordRound(PANGO_ASCENT(rect) / PANGO_SCALE * P2T); |
37 | - aDimensions.descent = NSToCoordRound(PANGO_DESCENT(rect) / PANGO_SCALE * P2T); |
38 | + aDimensions.width = NSToCoordRound(rect.width * P2T / PANGO_SCALE); |
39 | + aDimensions.ascent = NSToCoordRound(PANGO_ASCENT(rect) * P2T / PANGO_SCALE); |
40 | + aDimensions.descent = NSToCoordRound(PANGO_DESCENT(rect) * P2T / PANGO_SCALE); |
41 | |
42 | // printf("GetTextDimensions %d %d %d\n", aDimensions.width, |
43 | //aDimensions.ascent, aDimensions.descent); |
44 | @@ -880,12 +876,12 @@ |
45 | P2T = mDeviceContext->DevUnitsToAppUnits(); |
46 | |
47 | aBoundingMetrics.leftBearing = |
48 | - NSToCoordRound(rect.x / PANGO_SCALE * P2T); |
49 | + NSToCoordRound(rect.x * P2T / PANGO_SCALE); |
50 | aBoundingMetrics.rightBearing = |
51 | - NSToCoordRound(rect.width / PANGO_SCALE * P2T); |
52 | - aBoundingMetrics.width = NSToCoordRound((rect.x + rect.width) / PANGO_SCALE * P2T); |
53 | - aBoundingMetrics.ascent = NSToCoordRound(rect.y / PANGO_SCALE * P2T); |
54 | - aBoundingMetrics.descent = NSToCoordRound(rect.height / PANGO_SCALE * P2T); |
55 | + NSToCoordRound(rect.width * P2T / PANGO_SCALE); |
56 | + aBoundingMetrics.width = NSToCoordRound((rect.x + rect.width) * P2T / PANGO_SCALE); |
57 | + aBoundingMetrics.ascent = NSToCoordRound(rect.y * P2T / PANGO_SCALE); |
58 | + aBoundingMetrics.descent = NSToCoordRound(rect.height * P2T / PANGO_SCALE); |
59 | |
60 | loser: |
61 | g_free(text); |
62 | @@ -1118,11 +1114,11 @@ |
63 | |
64 | // Convert the width into app units |
65 | for (int i = 0; i < n_ranges; i++) { |
66 | - aWidth += (ranges[(i * 2) + 1] - ranges[(i * 2)]) / PANGO_SCALE; |
67 | + aWidth += (ranges[(i * 2) + 1] - ranges[(i * 2)]); |
68 | } |
69 | |
70 | f = mDeviceContext-> DevUnitsToAppUnits(); |
71 | - aWidth = nscoord(aWidth * f); |
72 | + aWidth = nscoord(aWidth * f / PANGO_SCALE); |
73 | |
74 | loser: |
75 | if (ranges) |