| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright © 2009 Red Hat, Inc. | 2 * Copyright © 2009 Red Hat, Inc. |
| 3 * Copyright © 2009 Keith Stribley | 3 * Copyright © 2009 Keith Stribley |
| 4 * | 4 * |
| 5 * This is part of HarfBuzz, a text shaping library. | 5 * This is part of HarfBuzz, a text shaping library. |
| 6 * | 6 * |
| 7 * Permission is hereby granted, without written agreement and without | 7 * Permission is hereby granted, without written agreement and without |
| 8 * license or royalty fees, to use, copy, modify, and distribute this | 8 * license or royalty fees, to use, copy, modify, and distribute this |
| 9 * software and its documentation for any purpose, provided that the | 9 * software and its documentation for any purpose, provided that the |
| 10 * above copyright notice and the following two paragraphs appear in | 10 * above copyright notice and the following two paragraphs appear in |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 hb_codepoint_t glyph, | 111 hb_codepoint_t glyph, |
| 112 void *user_data HB_UNUSED) | 112 void *user_data HB_UNUSED) |
| 113 { | 113 { |
| 114 FT_Face ft_face = (FT_Face) font_data; | 114 FT_Face ft_face = (FT_Face) font_data; |
| 115 int load_flags = FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING | FT_LOAD_VERTICAL_LAYOU
T; | 115 int load_flags = FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING | FT_LOAD_VERTICAL_LAYOU
T; |
| 116 FT_Fixed v; | 116 FT_Fixed v; |
| 117 | 117 |
| 118 if (unlikely (FT_Get_Advance (ft_face, glyph, load_flags, &v))) | 118 if (unlikely (FT_Get_Advance (ft_face, glyph, load_flags, &v))) |
| 119 return 0; | 119 return 0; |
| 120 | 120 |
| 121 if (font->y_scale < 0) |
| 122 v = -v; |
| 123 |
| 121 /* Note: FreeType's vertical metrics grows downward while other FreeType coord
inates | 124 /* Note: FreeType's vertical metrics grows downward while other FreeType coord
inates |
| 122 * have a Y growing upward. Hence the extra negation. */ | 125 * have a Y growing upward. Hence the extra negation. */ |
| 123 return (-v + (1<<9)) >> 10; | 126 return (-v + (1<<9)) >> 10; |
| 124 } | 127 } |
| 125 | 128 |
| 126 static hb_bool_t | 129 static hb_bool_t |
| 127 hb_ft_get_glyph_h_origin (hb_font_t *font HB_UNUSED, | 130 hb_ft_get_glyph_h_origin (hb_font_t *font HB_UNUSED, |
| 128 void *font_data HB_UNUSED, | 131 void *font_data HB_UNUSED, |
| 129 hb_codepoint_t glyph HB_UNUSED, | 132 hb_codepoint_t glyph HB_UNUSED, |
| 130 hb_position_t *x HB_UNUSED, | 133 hb_position_t *x HB_UNUSED, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 147 int load_flags = FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING; | 150 int load_flags = FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING; |
| 148 | 151 |
| 149 if (unlikely (FT_Load_Glyph (ft_face, glyph, load_flags))) | 152 if (unlikely (FT_Load_Glyph (ft_face, glyph, load_flags))) |
| 150 return false; | 153 return false; |
| 151 | 154 |
| 152 /* Note: FreeType's vertical metrics grows downward while other FreeType coord
inates | 155 /* Note: FreeType's vertical metrics grows downward while other FreeType coord
inates |
| 153 * have a Y growing upward. Hence the extra negation. */ | 156 * have a Y growing upward. Hence the extra negation. */ |
| 154 *x = ft_face->glyph->metrics.horiBearingX - ft_face->glyph->metrics.vertBear
ingX; | 157 *x = ft_face->glyph->metrics.horiBearingX - ft_face->glyph->metrics.vertBear
ingX; |
| 155 *y = ft_face->glyph->metrics.horiBearingY - (-ft_face->glyph->metrics.vertBear
ingY); | 158 *y = ft_face->glyph->metrics.horiBearingY - (-ft_face->glyph->metrics.vertBear
ingY); |
| 156 | 159 |
| 160 if (font->x_scale < 0) |
| 161 *x = -*x; |
| 162 if (font->y_scale < 0) |
| 163 *y = -*y; |
| 164 |
| 157 return true; | 165 return true; |
| 158 } | 166 } |
| 159 | 167 |
| 160 static hb_position_t | 168 static hb_position_t |
| 161 hb_ft_get_glyph_h_kerning (hb_font_t *font, | 169 hb_ft_get_glyph_h_kerning (hb_font_t *font, |
| 162 void *font_data, | 170 void *font_data, |
| 163 hb_codepoint_t left_glyph, | 171 hb_codepoint_t left_glyph, |
| 164 hb_codepoint_t right_glyph, | 172 hb_codepoint_t right_glyph, |
| 165 void *user_data HB_UNUSED) | 173 void *user_data HB_UNUSED) |
| 166 { | 174 { |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 | 566 |
| 559 FT_Face | 567 FT_Face |
| 560 hb_ft_font_get_face (hb_font_t *font) | 568 hb_ft_font_get_face (hb_font_t *font) |
| 561 { | 569 { |
| 562 if (font->destroy == (hb_destroy_func_t) FT_Done_Face || | 570 if (font->destroy == (hb_destroy_func_t) FT_Done_Face || |
| 563 font->destroy == (hb_destroy_func_t) _do_nothing) | 571 font->destroy == (hb_destroy_func_t) _do_nothing) |
| 564 return (FT_Face) font->user_data; | 572 return (FT_Face) font->user_data; |
| 565 | 573 |
| 566 return NULL; | 574 return NULL; |
| 567 } | 575 } |
| OLD | NEW |