| 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 * Copyright © 2015 Google, Inc. | 4 * Copyright © 2015 Google, Inc. |
| 5 * | 5 * |
| 6 * This is part of HarfBuzz, a text shaping library. | 6 * This is part of HarfBuzz, a text shaping library. |
| 7 * | 7 * |
| 8 * Permission is hereby granted, without written agreement and without | 8 * Permission is hereby granted, without written agreement and without |
| 9 * license or royalty fees, to use, copy, modify, and distribute this | 9 * license or royalty fees, to use, copy, modify, and distribute this |
| 10 * software and its documentation for any purpose, provided that the | 10 * software and its documentation for any purpose, provided that the |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 return NULL; | 148 return NULL; |
| 149 | 149 |
| 150 const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font->user_data; | 150 const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font->user_data; |
| 151 | 151 |
| 152 return ft_font->ft_face; | 152 return ft_font->ft_face; |
| 153 } | 153 } |
| 154 | 154 |
| 155 | 155 |
| 156 | 156 |
| 157 static hb_bool_t | 157 static hb_bool_t |
| 158 hb_ft_get_glyph (hb_font_t *font HB_UNUSED, | 158 hb_ft_get_nominal_glyph (hb_font_t *font HB_UNUSED, |
| 159 » » void *font_data, | 159 » » » void *font_data, |
| 160 » » hb_codepoint_t unicode, | 160 » » » hb_codepoint_t unicode, |
| 161 » » hb_codepoint_t variation_selector, | 161 » » » hb_codepoint_t *glyph, |
| 162 » » hb_codepoint_t *glyph, | 162 » » » void *user_data HB_UNUSED) |
| 163 » » void *user_data HB_UNUSED) | |
| 164 | |
| 165 { | 163 { |
| 166 const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font_data; | 164 const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font_data; |
| 167 unsigned int g; | 165 unsigned int g = FT_Get_Char_Index (ft_font->ft_face, unicode); |
| 168 | |
| 169 if (likely (!variation_selector)) | |
| 170 g = FT_Get_Char_Index (ft_font->ft_face, unicode); | |
| 171 else | |
| 172 g = FT_Face_GetCharVariantIndex (ft_font->ft_face, unicode, variation_select
or); | |
| 173 | 166 |
| 174 if (unlikely (!g)) | 167 if (unlikely (!g)) |
| 175 return false; | 168 return false; |
| 169 |
| 170 *glyph = g; |
| 171 return true; |
| 172 } |
| 173 |
| 174 static hb_bool_t |
| 175 hb_ft_get_variation_glyph (hb_font_t *font HB_UNUSED, |
| 176 void *font_data, |
| 177 hb_codepoint_t unicode, |
| 178 hb_codepoint_t variation_selector, |
| 179 hb_codepoint_t *glyph, |
| 180 void *user_data HB_UNUSED) |
| 181 { |
| 182 const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font_data; |
| 183 unsigned int g = FT_Face_GetCharVariantIndex (ft_font->ft_face, unicode, varia
tion_selector); |
| 184 |
| 185 if (unlikely (!g)) |
| 186 return false; |
| 176 | 187 |
| 177 *glyph = g; | 188 *glyph = g; |
| 178 return true; | 189 return true; |
| 179 } | 190 } |
| 180 | 191 |
| 181 static hb_position_t | 192 static hb_position_t |
| 182 hb_ft_get_glyph_h_advance (hb_font_t *font HB_UNUSED, | 193 hb_ft_get_glyph_h_advance (hb_font_t *font HB_UNUSED, |
| 183 void *font_data, | 194 void *font_data, |
| 184 hb_codepoint_t glyph, | 195 hb_codepoint_t glyph, |
| 185 void *user_data HB_UNUSED) | 196 void *user_data HB_UNUSED) |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 { | 412 { |
| 402 retry: | 413 retry: |
| 403 hb_font_funcs_t *funcs = (hb_font_funcs_t *) hb_atomic_ptr_get (&static_ft_fun
cs); | 414 hb_font_funcs_t *funcs = (hb_font_funcs_t *) hb_atomic_ptr_get (&static_ft_fun
cs); |
| 404 | 415 |
| 405 if (unlikely (!funcs)) | 416 if (unlikely (!funcs)) |
| 406 { | 417 { |
| 407 funcs = hb_font_funcs_create (); | 418 funcs = hb_font_funcs_create (); |
| 408 | 419 |
| 409 hb_font_funcs_set_font_h_extents_func (funcs, hb_ft_get_font_h_extents, NULL
, NULL); | 420 hb_font_funcs_set_font_h_extents_func (funcs, hb_ft_get_font_h_extents, NULL
, NULL); |
| 410 //hb_font_funcs_set_font_v_extents_func (funcs, hb_ft_get_font_v_extents, NU
LL, NULL); | 421 //hb_font_funcs_set_font_v_extents_func (funcs, hb_ft_get_font_v_extents, NU
LL, NULL); |
| 411 hb_font_funcs_set_glyph_func (funcs, hb_ft_get_glyph, NULL, NULL); | 422 hb_font_funcs_set_nominal_glyph_func (funcs, hb_ft_get_nominal_glyph, NULL,
NULL); |
| 423 hb_font_funcs_set_variation_glyph_func (funcs, hb_ft_get_variation_glyph, NU
LL, NULL); |
| 412 hb_font_funcs_set_glyph_h_advance_func (funcs, hb_ft_get_glyph_h_advance, NU
LL, NULL); | 424 hb_font_funcs_set_glyph_h_advance_func (funcs, hb_ft_get_glyph_h_advance, NU
LL, NULL); |
| 413 hb_font_funcs_set_glyph_v_advance_func (funcs, hb_ft_get_glyph_v_advance, NU
LL, NULL); | 425 hb_font_funcs_set_glyph_v_advance_func (funcs, hb_ft_get_glyph_v_advance, NU
LL, NULL); |
| 414 //hb_font_funcs_set_glyph_h_origin_func (funcs, hb_ft_get_glyph_h_origin, NU
LL, NULL); | 426 //hb_font_funcs_set_glyph_h_origin_func (funcs, hb_ft_get_glyph_h_origin, NU
LL, NULL); |
| 415 hb_font_funcs_set_glyph_v_origin_func (funcs, hb_ft_get_glyph_v_origin, NULL
, NULL); | 427 hb_font_funcs_set_glyph_v_origin_func (funcs, hb_ft_get_glyph_v_origin, NULL
, NULL); |
| 416 hb_font_funcs_set_glyph_h_kerning_func (funcs, hb_ft_get_glyph_h_kerning, NU
LL, NULL); | 428 hb_font_funcs_set_glyph_h_kerning_func (funcs, hb_ft_get_glyph_h_kerning, NU
LL, NULL); |
| 417 //hb_font_funcs_set_glyph_v_kerning_func (funcs, hb_ft_get_glyph_v_kerning,
NULL, NULL); | 429 //hb_font_funcs_set_glyph_v_kerning_func (funcs, hb_ft_get_glyph_v_kerning,
NULL, NULL); |
| 418 hb_font_funcs_set_glyph_extents_func (funcs, hb_ft_get_glyph_extents, NULL,
NULL); | 430 hb_font_funcs_set_glyph_extents_func (funcs, hb_ft_get_glyph_extents, NULL,
NULL); |
| 419 hb_font_funcs_set_glyph_contour_point_func (funcs, hb_ft_get_glyph_contour_p
oint, NULL, NULL); | 431 hb_font_funcs_set_glyph_contour_point_func (funcs, hb_ft_get_glyph_contour_p
oint, NULL, NULL); |
| 420 hb_font_funcs_set_glyph_name_func (funcs, hb_ft_get_glyph_name, NULL, NULL); | 432 hb_font_funcs_set_glyph_name_func (funcs, hb_ft_get_glyph_name, NULL, NULL); |
| 421 hb_font_funcs_set_glyph_from_name_func (funcs, hb_ft_get_glyph_from_name, NU
LL, NULL); | 433 hb_font_funcs_set_glyph_from_name_func (funcs, hb_ft_get_glyph_from_name, NU
LL, NULL); |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 0, font->y_scale < 0 ? -1 : +1}; | 690 0, font->y_scale < 0 ? -1 : +1}; |
| 679 FT_Set_Transform (ft_face, &matrix, NULL); | 691 FT_Set_Transform (ft_face, &matrix, NULL); |
| 680 } | 692 } |
| 681 | 693 |
| 682 ft_face->generic.data = blob; | 694 ft_face->generic.data = blob; |
| 683 ft_face->generic.finalizer = (FT_Generic_Finalizer) _release_blob; | 695 ft_face->generic.finalizer = (FT_Generic_Finalizer) _release_blob; |
| 684 | 696 |
| 685 _hb_ft_font_set_funcs (font, ft_face, true); | 697 _hb_ft_font_set_funcs (font, ft_face, true); |
| 686 hb_ft_font_set_load_flags (font, FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING); | 698 hb_ft_font_set_load_flags (font, FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING); |
| 687 } | 699 } |
| OLD | NEW |