aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2000-05-03 11:39:25 +0000
committerGerd Moellmann2000-05-03 11:39:25 +0000
commit329bed06e9c6412dd621827fc302ef2dc21929e7 (patch)
treeee36625b033fa5b1ffa6b5af42279b5657c3719f /src
parent96f66dc5f257ecb67edb02a1e371f56a40bebe59 (diff)
downloademacs-329bed06e9c6412dd621827fc302ef2dc21929e7.tar.gz
emacs-329bed06e9c6412dd621827fc302ef2dc21929e7.zip
(x_produce_glyphs) <composite chars>: Handle case
that x_per_char_metric returns null.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c59
1 files changed, 42 insertions, 17 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 2629ec943bd..28280a4bd46 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -2049,16 +2049,30 @@ x_produce_glyphs (it)
2049 int font_descent = font->descent - boff; 2049 int font_descent = font->descent - boff;
2050 /* Bounding box of the overall glyphs. */ 2050 /* Bounding box of the overall glyphs. */
2051 int leftmost, rightmost, lowest, highest; 2051 int leftmost, rightmost, lowest, highest;
2052 int i; 2052 int i, width, ascent, descent;
2053 2053
2054 cmp->font = (void *) font; 2054 cmp->font = (void *) font;
2055 2055
2056 /* Initialize the bounding box. */ 2056 /* Initialize the bounding box. */
2057 pcm = x_per_char_metric (font, &char2b); 2057 pcm = x_per_char_metric (font, &char2b);
2058 if (pcm)
2059 {
2060 width = pcm->width;
2061 ascent = pcm->ascent;
2062 descent = pcm->descent;
2063 }
2064 else
2065 {
2066 width = FONT_WIDTH (font);
2067 ascent = font->ascent;
2068 descent = font->descent;
2069 }
2070
2071 rightmost = width;
2072 lowest = - descent + boff;
2073 highest = ascent + boff;
2058 leftmost = 0; 2074 leftmost = 0;
2059 rightmost = pcm->width; 2075
2060 lowest = - pcm->descent + boff;
2061 highest = pcm->ascent + boff;
2062 if (font_info 2076 if (font_info
2063 && font_info->default_ascent 2077 && font_info->default_ascent
2064 && CHAR_TABLE_P (Vuse_default_ascent) 2078 && CHAR_TABLE_P (Vuse_default_ascent)
@@ -2099,26 +2113,37 @@ x_produce_glyphs (it)
2099 } 2113 }
2100 2114
2101 pcm = x_per_char_metric (font, &char2b); 2115 pcm = x_per_char_metric (font, &char2b);
2116 if (pcm)
2117 {
2118 width = pcm->width;
2119 ascent = pcm->ascent;
2120 descent = pcm->descent;
2121 }
2122 else
2123 {
2124 width = FONT_WIDTH (font);
2125 ascent = font->ascent;
2126 descent = font->descent;
2127 }
2102 2128
2103 if (cmp->method != COMPOSITION_WITH_RULE_ALTCHARS) 2129 if (cmp->method != COMPOSITION_WITH_RULE_ALTCHARS)
2104 { 2130 {
2105 /* Relative composition with or without 2131 /* Relative composition with or without
2106 alternate chars. */ 2132 alternate chars. */
2107 left = (leftmost + rightmost - pcm->width) / 2; 2133 left = (leftmost + rightmost - width) / 2;
2108 btm = - pcm->descent + boff; 2134 btm = - descent + boff;
2109 if (font_info && font_info->relative_compose 2135 if (font_info && font_info->relative_compose
2110 && (! CHAR_TABLE_P (Vignore_relative_composition) 2136 && (! CHAR_TABLE_P (Vignore_relative_composition)
2111 || NILP (Faref (Vignore_relative_composition, 2137 || NILP (Faref (Vignore_relative_composition,
2112 make_number (ch))))) 2138 make_number (ch)))))
2113 { 2139 {
2114 2140
2115 if (- pcm->descent 2141 if (- descent >= font_info->relative_compose)
2116 >= font_info->relative_compose)
2117 /* One extra pixel between two glyphs. */ 2142 /* One extra pixel between two glyphs. */
2118 btm = highest + 1; 2143 btm = highest + 1;
2119 else if (pcm->ascent <= 0) 2144 else if (ascent <= 0)
2120 /* One extra pixel between two glyphs. */ 2145 /* One extra pixel between two glyphs. */
2121 btm = lowest - 1 - pcm->ascent - pcm->descent; 2146 btm = lowest - 1 - ascent - descent;
2122 } 2147 }
2123 } 2148 }
2124 else 2149 else
@@ -2147,23 +2172,23 @@ x_produce_glyphs (it)
2147 2172
2148 left = (leftmost 2173 left = (leftmost
2149 + grefx * (rightmost - leftmost) / 2 2174 + grefx * (rightmost - leftmost) / 2
2150 - nrefx * pcm->width / 2); 2175 - nrefx * width / 2);
2151 btm = ((grefy == 0 ? highest 2176 btm = ((grefy == 0 ? highest
2152 : grefy == 1 ? 0 2177 : grefy == 1 ? 0
2153 : grefy == 2 ? lowest 2178 : grefy == 2 ? lowest
2154 : (highest + lowest) / 2) 2179 : (highest + lowest) / 2)
2155 - (nrefy == 0 ? pcm->ascent + pcm->descent 2180 - (nrefy == 0 ? ascent + descent
2156 : nrefy == 1 ? pcm->descent - boff 2181 : nrefy == 1 ? descent - boff
2157 : nrefy == 2 ? 0 2182 : nrefy == 2 ? 0
2158 : (pcm->ascent + pcm->descent) / 2)); 2183 : (ascent + descent) / 2));
2159 } 2184 }
2160 2185
2161 cmp->offsets[i * 2] = left; 2186 cmp->offsets[i * 2] = left;
2162 cmp->offsets[i * 2 + 1] = btm + pcm->descent; 2187 cmp->offsets[i * 2 + 1] = btm + descent;
2163 2188
2164 /* Update the bounding box of the overall glyphs. */ 2189 /* Update the bounding box of the overall glyphs. */
2165 right = left + pcm->width; 2190 right = left + width;
2166 top = btm + pcm->descent + pcm->ascent; 2191 top = btm + descent + ascent;
2167 if (left < leftmost) 2192 if (left < leftmost)
2168 leftmost = left; 2193 leftmost = left;
2169 if (right > rightmost) 2194 if (right > rightmost)