ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtfont.C
(Generate patch)

Comparing rxvt-unicode/src/rxvtfont.C (file contents):
Revision 1.71 by root, Sat Jun 18 10:02:35 2005 UTC vs.
Revision 1.72 by root, Sat Jun 18 10:59:21 2005 UTC

851 851
852 XCharStruct g; 852 XCharStruct g;
853 int dir_ret, asc_ret, des_ret; 853 int dir_ret, asc_ret, des_ret;
854 XTextExtents16 (f, &ch, 1, &dir_ret, &asc_ret, &des_ret, &g); 854 XTextExtents16 (f, &ch, 1, &dir_ret, &asc_ret, &des_ret, &g);
855 855
856 int wcw = wcwidth (*t); if (wcw > 0) g.width = g.width / wcw; 856 int wcw = wcwidth (*t); if (wcw > 0) g.width = (g.width + wcw - 1) / wcw;
857 857
858 if (width < g.width) width = g.width; 858 if (width < g.width) width = g.width;
859 } 859 }
860 860
861 if (cs == CS_UNKNOWN) 861 if (cs == CS_UNKNOWN)
936 return true; 936 return true;
937 937
938 // check character against base font bounding box 938 // check character against base font bounding box
939 int w = xcs->width; 939 int w = xcs->width;
940 int wcw = wcwidth (unicode); 940 int wcw = wcwidth (unicode);
941 if (wcw > 0) w /= wcw; 941 if (wcw > 0) w = (w + wcw - 1) / wcw;
942 942
943 careful = w > prop->width; 943 careful = w > prop->width;
944 if (careful && w > prop->width * MAX_OVERLAP >> 2) 944 if (careful && w > prop->width * MAX_OVERLAP >> 2)
945 return false; 945 return false;
946 946
1154 1154
1155 bool scalable = face->face_flags & FT_FACE_FLAG_SCALABLE; 1155 bool scalable = face->face_flags & FT_FACE_FLAG_SCALABLE;
1156 1156
1157 XftUnlockFace (f); 1157 XftUnlockFace (f);
1158 1158
1159 int glheight = height;
1160
1159 for (uint16_t *t = extent_test_chars + NUM_EXTENT_TEST_CHARS; t-- > extent_test_chars; ) 1161 for (uint16_t *t = extent_test_chars + NUM_EXTENT_TEST_CHARS; t-- > extent_test_chars; )
1160 { 1162 {
1161 FcChar16 ch = *t; 1163 FcChar16 ch = *t;
1162 1164
1163 if (cs != CS_UNICODE 1165 if (cs != CS_UNICODE
1171 continue; 1173 continue;
1172 1174
1173 XGlyphInfo g; 1175 XGlyphInfo g;
1174 XftTextExtents16 (disp, f, &ch, 1, &g); 1176 XftTextExtents16 (disp, f, &ch, 1, &g);
1175 1177
1178 g.width -= g.x;
1179
1176 int wcw = wcwidth (ch); 1180 int wcw = wcwidth (ch);
1177 if (wcw > 0) g.width = g.width / wcw; 1181 if (wcw > 0) g.width = (g.width + wcw - 1) / wcw;
1178 1182
1179 if (width < g.width) width = g.width; 1183 if (width < g.width ) width = g.width;
1180 if (height < g.height) height = g.height; 1184 if (height < g.height ) height = g.height;
1185 if (glheight < g.height - g.y) glheight = g.height - g.y;
1181 } 1186 }
1182 1187
1183 if (prop.height == rxvt_fontprop::unset 1188 if (prop.height == rxvt_fontprop::unset
1184 || height <= prop.height 1189 || (height <= prop.height && glheight <= prop.height)
1185 || height <= 2 1190 || height <= 2
1186 || !scalable) 1191 || !scalable)
1187 break; 1192 break;
1188 1193
1189 if (ftheight) 1194 if (ftheight)
1230 // check character against base font bounding box 1235 // check character against base font bounding box
1231 FcChar32 ch = unicode; 1236 FcChar32 ch = unicode;
1232 XGlyphInfo g; 1237 XGlyphInfo g;
1233 XftTextExtents32 (DISPLAY, f, &ch, 1, &g); 1238 XftTextExtents32 (DISPLAY, f, &ch, 1, &g);
1234 1239
1235 int w = g.width; 1240 int w = g.width - g.x;
1236 int wcw = wcwidth (unicode); 1241 int wcw = wcwidth (unicode);
1237 if (wcw > 0) w /= wcw; 1242 if (wcw > 0) w = (w + wcw - 1) / wcw;
1238 1243
1239 careful = w > prop->width; 1244 careful = w > prop->width;
1240 if (careful && w > prop->width * MAX_OVERLAP >> 2) 1245 if (careful && w > prop->width * MAX_OVERLAP >> 2)
1241 return false; 1246 return false;
1242 1247

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines