diff options
| author | Alp Aker | 2011-07-28 14:50:05 -0400 |
|---|---|---|
| committer | Chong Yidong | 2011-07-28 14:50:05 -0400 |
| commit | d55e9c533fececfe4a934fe5a770dbe259d478a0 (patch) | |
| tree | d10bc2ba4ad3ffda2f48611b1240b7727e5efc54 /src | |
| parent | bf3492a57ec757c0efadb6e821daa507e499057d (diff) | |
| download | emacs-d55e9c533fececfe4a934fe5a770dbe259d478a0.tar.gz emacs-d55e9c533fececfe4a934fe5a770dbe259d478a0.zip | |
Fix for raise display property on NS (Bug#8913).
* src/nsfont.m (nsfont_open): Remove assignment to voffset and
unnecessary vars hshink, expand, hd, full_height, min_height.
(nsfont_draw): Use s->ybase as baseline for glyph drawing.
* src/nsterm.h (nsfont_info): Remove voffset field.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/nsfont.m | 18 | ||||
| -rw-r--r-- | src/nsterm.h | 1 |
3 files changed, 9 insertions, 16 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 3f9c098b99a..f6f64f4211d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -12,6 +12,12 @@ | |||
| 12 | * nsterm.m (ns_dumpglyphs_stretch): Avoid overwriting left fringe | 12 | * nsterm.m (ns_dumpglyphs_stretch): Avoid overwriting left fringe |
| 13 | or scroll bar (Bug#8470). | 13 | or scroll bar (Bug#8470). |
| 14 | 14 | ||
| 15 | * nsfont.m (nsfont_open): Remove assignment to voffset and | ||
| 16 | unnecessary vars hshink, expand, hd, full_height, min_height. | ||
| 17 | (nsfont_draw): Use s->ybase as baseline for glyph drawing (Bug#8913). | ||
| 18 | |||
| 19 | * nsterm.h (nsfont_info): Remove voffset field. | ||
| 20 | |||
| 15 | 2011-07-28 Alp Aker <alp.tekin.aker@gmail.com> | 21 | 2011-07-28 Alp Aker <alp.tekin.aker@gmail.com> |
| 16 | 22 | ||
| 17 | Implement strike-through and overline on NextStep (Bug#8863). | 23 | Implement strike-through and overline on NextStep (Bug#8863). |
diff --git a/src/nsfont.m b/src/nsfont.m index 3720e9a4615..60f8c5321aa 100644 --- a/src/nsfont.m +++ b/src/nsfont.m | |||
| @@ -804,8 +804,6 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) | |||
| 804 | font->props[FONT_FILE_INDEX] = Qnil; | 804 | font->props[FONT_FILE_INDEX] = Qnil; |
| 805 | 805 | ||
| 806 | { | 806 | { |
| 807 | double expand, hshrink; | ||
| 808 | float full_height, min_height, hd; | ||
| 809 | const char *fontName = [[nsfont fontName] UTF8String]; | 807 | const char *fontName = [[nsfont fontName] UTF8String]; |
| 810 | int len = strlen (fontName); | 808 | int len = strlen (fontName); |
| 811 | 809 | ||
| @@ -837,26 +835,16 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) | |||
| 837 | [sfont maximumAdvancement].width : ns_char_width (sfont, '0'); | 835 | [sfont maximumAdvancement].width : ns_char_width (sfont, '0'); |
| 838 | 836 | ||
| 839 | brect = [sfont boundingRectForFont]; | 837 | brect = [sfont boundingRectForFont]; |
| 840 | full_height = brect.size.height; | ||
| 841 | min_height = [sfont ascender] - adjusted_descender; | ||
| 842 | hd = full_height - min_height; | ||
| 843 | |||
| 844 | /* standard height, similar to Carbon. Emacs.app: was 0.5 by default. */ | ||
| 845 | expand = 0.0; | ||
| 846 | hshrink = 1.0; | ||
| 847 | 838 | ||
| 848 | font_info->underpos = [sfont underlinePosition]; | 839 | font_info->underpos = [sfont underlinePosition]; |
| 849 | font_info->underwidth = [sfont underlineThickness]; | 840 | font_info->underwidth = [sfont underlineThickness]; |
| 850 | font_info->size = font->pixel_size; | 841 | font_info->size = font->pixel_size; |
| 851 | font_info->voffset = lrint (hshrink * [sfont ascender] + expand * hd / 2); | ||
| 852 | 842 | ||
| 853 | /* max bounds */ | 843 | /* max bounds */ |
| 854 | font_info->max_bounds.ascent = | 844 | font_info->max_bounds.ascent = lrint ([sfont ascender]); |
| 855 | lrint (hshrink * [sfont ascender] + expand * hd/2); | ||
| 856 | /* Descender is usually negative. Use floor to avoid | 845 | /* Descender is usually negative. Use floor to avoid |
| 857 | clipping descenders. */ | 846 | clipping descenders. */ |
| 858 | font_info->max_bounds.descent = | 847 | font_info->max_bounds.descent = -lrint (floor(adjusted_descender)); |
| 859 | -lrint (floor(hshrink* adjusted_descender - expand*hd/2)); | ||
| 860 | font_info->height = | 848 | font_info->height = |
| 861 | font_info->max_bounds.ascent + font_info->max_bounds.descent; | 849 | font_info->max_bounds.ascent + font_info->max_bounds.descent; |
| 862 | font_info->max_bounds.width = lrint (font_info->width); | 850 | font_info->max_bounds.width = lrint (font_info->width); |
| @@ -1165,7 +1153,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 1165 | 1153 | ||
| 1166 | 1154 | ||
| 1167 | /* set up for character rendering */ | 1155 | /* set up for character rendering */ |
| 1168 | r.origin.y += font->voffset + (s->height - font->height)/2; | 1156 | r.origin.y = s->ybase; |
| 1169 | 1157 | ||
| 1170 | col = (NS_FACE_FOREGROUND (face) != 0 | 1158 | col = (NS_FACE_FOREGROUND (face) != 0 |
| 1171 | ? ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f) | 1159 | ? ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f) |
diff --git a/src/nsterm.h b/src/nsterm.h index 227429ed515..6ea9161c922 100644 --- a/src/nsterm.h +++ b/src/nsterm.h | |||
| @@ -467,7 +467,6 @@ struct nsfont_info | |||
| 467 | #endif | 467 | #endif |
| 468 | char bold, ital; /* convenience flags */ | 468 | char bold, ital; /* convenience flags */ |
| 469 | char synthItal; | 469 | char synthItal; |
| 470 | float voffset; /* mean of ascender/descender offsets */ | ||
| 471 | XCharStruct max_bounds; | 470 | XCharStruct max_bounds; |
| 472 | /* we compute glyph codes and metrics on-demand in blocks of 256 indexed | 471 | /* we compute glyph codes and metrics on-demand in blocks of 256 indexed |
| 473 | by hibyte, lobyte */ | 472 | by hibyte, lobyte */ |