Guest User

Untitled

a guest
Dec 9th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.53 KB | None | 0 0
  1. diff --git a/src/rxvtfont.C b/src/rxvtfont.C
  2. index 5dcd125..65ba55f 100644
  3. --- a/src/rxvtfont.C
  4. +++ b/src/rxvtfont.C
  5. @@ -1052,6 +1052,9 @@ rxvt_font_x11::draw (rxvt_drawable &d, int x, int y,
  6.  
  7. int base = ascent; // sorry, incorrect: term->fbase;
  8.  
  9. + if (term->lineSpace > 0)
  10. + base += term->lineSpace >> 1;
  11. +
  12. XGCValues v;
  13. v.foreground = term->pix_colors[fg];
  14. v.font = f->fid;
  15. @@ -1223,92 +1226,63 @@ rxvt_font_xft::load (const rxvt_fontprop &prop, bool force_prop)
  16. return false;
  17.  
  18. int ftheight = 0;
  19. - bool success = true;
  20. -
  21. - for (;;)
  22. - {
  23. - p = FcPatternDuplicate (match);
  24. - f = XftFontOpenPattern (disp, p);
  25. -
  26. - if (!f)
  27. - {
  28. - FcPatternDestroy (p);
  29. - success = false;
  30. - break;
  31. - }
  32. -
  33. - FT_Face face = XftLockFace (f);
  34. -
  35. - ascent = (face->size->metrics.ascender + 63) >> 6;
  36. - descent = (-face->size->metrics.descender + 63) >> 6;
  37. - height = max (ascent + descent, (face->size->metrics.height + 63) >> 6);
  38. - width = 0;
  39.  
  40. - bool scalable = face->face_flags & FT_FACE_FLAG_SCALABLE;
  41. + p = FcPatternDuplicate (match);
  42. + f = XftFontOpenPattern (disp, p);
  43.  
  44. - XftUnlockFace (f);
  45. -
  46. - int glheight = height;
  47. + if (!f)
  48. + {
  49. + FcPatternDestroy (p);
  50. + return false;
  51. + }
  52.  
  53. - for (uint16_t *t = extent_test_chars; t < extent_test_chars + ecb_array_length (extent_test_chars); t++)
  54. - {
  55. - FcChar16 ch = *t;
  56. + FT_Face face = XftLockFace (f);
  57.  
  58. - if (cs != CS_UNICODE
  59. - && ch > 0x100
  60. - && FROM_UNICODE (cs, ch) == NOCHAR)
  61. - continue;
  62. + ascent = f->ascent;
  63. + descent = f->descent;
  64. + height = max (ascent + descent, f->height);
  65. + width = 0;
  66.  
  67. - // ignore characters we wouldn't use anyways
  68. - bool careful;
  69. - if (!has_char (*t, &prop, careful))
  70. - continue;
  71. + bool scalable = face->face_flags & FT_FACE_FLAG_SCALABLE;
  72.  
  73. - XGlyphInfo g;
  74. - XftTextExtents16 (disp, f, &ch, 1, &g);
  75. + XftUnlockFace (f);
  76.  
  77. - g.width -= g.x;
  78. + for (uint16_t *t = extent_test_chars; t < extent_test_chars + ecb_array_length (extent_test_chars); t++)
  79. + {
  80. + FcChar16 ch = *t;
  81.  
  82. - int wcw = WCWIDTH (ch);
  83. - if (wcw > 0) g.width = (g.width + wcw - 1) / wcw;
  84. + if (cs != CS_UNICODE
  85. + && ch > 0x100
  86. + && FROM_UNICODE (cs, ch) == NOCHAR)
  87. + continue;
  88.  
  89. - if (width < g.width ) width = g.width;
  90. - if (height < g.height ) height = g.height;
  91. - if (glheight < g.height - g.y) glheight = g.height - g.y;
  92. - }
  93. + // ignore characters we wouldn't use anyways
  94. + bool careful;
  95. + if (!has_char (*t, &prop, careful))
  96. + continue;
  97.  
  98. - if (!width)
  99. - {
  100. - rxvt_warn ("unable to calculate font width for '%s', ignoring.\n", name);
  101. + XGlyphInfo g;
  102. + XftTextExtents16 (disp, f, &ch, 1, &g);
  103.  
  104. - XftFontClose (disp, f);
  105. - f = 0;
  106. + g.width -= g.x;
  107.  
  108. - success = false;
  109. - break;
  110. - }
  111. + int wcw = WCWIDTH (ch);
  112. + if (wcw > 1) g.xOff = g.xOff / wcw;
  113.  
  114. - if (prop.height == rxvt_fontprop::unset
  115. - || (height <= prop.height && glheight <= prop.height)
  116. - || height <= 2
  117. - || !scalable)
  118. - break;
  119. + if (width < g.xOff ) width = g.xOff;
  120. + if (height < g.height) height = g.height;
  121. + }
  122.  
  123. - if (ftheight)
  124. - {
  125. - // take smaller steps near the end
  126. - if (height > prop.height + 1) ftheight++;
  127. - if (height > prop.height + 2) ftheight++;
  128. - if (height > prop.height + 3) ftheight++;
  129. + bool success = true;
  130.  
  131. - ftheight -= height - prop.height;
  132. - }
  133. - else
  134. - ftheight = prop.height - 1;
  135. + if (!width)
  136. + {
  137. + rxvt_warn ("unable to calculate font width for '%s', ignoring.\n", name);
  138.  
  139. XftFontClose (disp, f);
  140. - FcPatternDel (match, FC_PIXEL_SIZE);
  141. - FcPatternAddInteger (match, FC_PIXEL_SIZE, ftheight);
  142. + f = 0;
  143. +
  144. + success = false;
  145. }
  146.  
  147. FcPatternDestroy (match);
  148. @@ -1395,7 +1369,7 @@ rxvt_font_xft::draw (rxvt_drawable &d, int x, int y,
  149.  
  150. ep->glyph = glyph;
  151. ep->x = x_ + (cwidth - extents.xOff >> 1);
  152. - ep->y = y_ + ascent;
  153. + ep->y = y_ + (term->fheight * ((float)ascent / height));
  154.  
  155. if (extents.xOff == 0)
  156. ep->x = x_ + cwidth;
  157. diff --git a/src/screen.C b/src/screen.C
  158. index 1e941cf..f320a4b 100644
  159. --- a/src/screen.C
  160. +++ b/src/screen.C
  161. @@ -2436,8 +2436,8 @@ rxvt_term::scr_refresh () NOTHROW
  162. XSetForeground (dpy, gc, pix_colors[fore]);
  163.  
  164. XDrawLine (dpy, vt, gc,
  165. - xpixel, ypixel + font->ascent + 1,
  166. - xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1);
  167. + xpixel, ypixel + Height2Pixel (1) - 1,
  168. + xpixel + Width2Pixel (count) - 1, ypixel + Height2Pixel (1) - 1);
  169. }
  170. } /* for (col....) */
  171. } /* for (row....) */
  172. diff --git a/src/table/jis0208_1990_0.h b/src/table/jis0208_1990_0.h
  173. index b23378f..0febcd3 100644
  174. --- a/src/table/jis0208_1990_0.h
  175. +++ b/src/table/jis0208_1990_0.h
  176. @@ -2241,6 +2241,7 @@ const uint16_t *jis0208_1990_0_f_i[] = {
  177.  
  178. static uint32_t cs_jis0208_1990_0_from_unicode (unicode_t unicode) {
  179. if (unicode == 0x2312) return 0x225e;
  180. + if (unicode == 0xff5e) return 0x2141;
  181. uint8_t l = unicode;
  182. uint16_t h = unicode >> 8;
  183. if (0x00 <= h && h <= 0xff
Add Comment
Please, Sign In to add comment