Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(393)

Side by Side Diff: third_party/harfbuzz-ng/src/hb-ft.cc

Issue 1580513002: Roll HarfBuzz to 1.1.3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build fix Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-ft.h ('k') | third_party/harfbuzz-ng/src/hb-glib.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 /* Check whether the given name was actually the name of glyph 0. */ 359 /* Check whether the given name was actually the name of glyph 0. */
360 char buf[128]; 360 char buf[128];
361 if (!FT_Get_Glyph_Name(ft_face, 0, buf, sizeof (buf)) && 361 if (!FT_Get_Glyph_Name(ft_face, 0, buf, sizeof (buf)) &&
362 len < 0 ? !strcmp (buf, name) : !strncmp (buf, name, len)) 362 len < 0 ? !strcmp (buf, name) : !strncmp (buf, name, len))
363 return true; 363 return true;
364 } 364 }
365 365
366 return *glyph != 0; 366 return *glyph != 0;
367 } 367 }
368 368
369 static hb_bool_t
370 hb_ft_get_font_h_extents (hb_font_t *font HB_UNUSED,
371 void *font_data,
372 hb_font_extents_t *metrics,
373 void *user_data HB_UNUSED)
374 {
375 const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font_data;
376 FT_Face ft_face = ft_font->ft_face;
377 metrics->ascender = ft_face->size->metrics.ascender;
378 metrics->descender = ft_face->size->metrics.descender;
379 metrics->line_gap = ft_face->size->metrics.height - (ft_face->size->metrics.as cender - ft_face->size->metrics.descender);
380 if (font->y_scale < 0)
381 {
382 metrics->ascender = -metrics->ascender;
383 metrics->descender = -metrics->descender;
384 metrics->line_gap = -metrics->line_gap;
385 }
386 return true;
387 }
369 388
370 static hb_font_funcs_t *static_ft_funcs = NULL; 389 static hb_font_funcs_t *static_ft_funcs = NULL;
371 390
372 #ifdef HB_USE_ATEXIT 391 #ifdef HB_USE_ATEXIT
373 static 392 static
374 void free_static_ft_funcs (void) 393 void free_static_ft_funcs (void)
375 { 394 {
376 hb_font_funcs_destroy (static_ft_funcs); 395 hb_font_funcs_destroy (static_ft_funcs);
377 } 396 }
378 #endif 397 #endif
379 398
380 static void 399 static void
381 _hb_ft_font_set_funcs (hb_font_t *font, FT_Face ft_face, bool unref) 400 _hb_ft_font_set_funcs (hb_font_t *font, FT_Face ft_face, bool unref)
382 { 401 {
383 retry: 402 retry:
384 hb_font_funcs_t *funcs = (hb_font_funcs_t *) hb_atomic_ptr_get (&static_ft_fun cs); 403 hb_font_funcs_t *funcs = (hb_font_funcs_t *) hb_atomic_ptr_get (&static_ft_fun cs);
385 404
386 if (unlikely (!funcs)) 405 if (unlikely (!funcs))
387 { 406 {
388 funcs = hb_font_funcs_create (); 407 funcs = hb_font_funcs_create ();
389 408
409 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);
390 hb_font_funcs_set_glyph_func (funcs, hb_ft_get_glyph, NULL, NULL); 411 hb_font_funcs_set_glyph_func (funcs, hb_ft_get_glyph, NULL, NULL);
391 hb_font_funcs_set_glyph_h_advance_func (funcs, hb_ft_get_glyph_h_advance, NU LL, NULL); 412 hb_font_funcs_set_glyph_h_advance_func (funcs, hb_ft_get_glyph_h_advance, NU LL, NULL);
392 hb_font_funcs_set_glyph_v_advance_func (funcs, hb_ft_get_glyph_v_advance, NU LL, NULL); 413 hb_font_funcs_set_glyph_v_advance_func (funcs, hb_ft_get_glyph_v_advance, NU LL, NULL);
393 //hb_font_funcs_set_glyph_h_origin_func (funcs, hb_ft_get_glyph_h_origin, NU LL, NULL); 414 //hb_font_funcs_set_glyph_h_origin_func (funcs, hb_ft_get_glyph_h_origin, NU LL, NULL);
394 hb_font_funcs_set_glyph_v_origin_func (funcs, hb_ft_get_glyph_v_origin, NULL , NULL); 415 hb_font_funcs_set_glyph_v_origin_func (funcs, hb_ft_get_glyph_v_origin, NULL , NULL);
395 hb_font_funcs_set_glyph_h_kerning_func (funcs, hb_ft_get_glyph_h_kerning, NU LL, NULL); 416 hb_font_funcs_set_glyph_h_kerning_func (funcs, hb_ft_get_glyph_h_kerning, NU LL, NULL);
396 //hb_font_funcs_set_glyph_v_kerning_func (funcs, hb_ft_get_glyph_v_kerning, NULL, NULL); 417 //hb_font_funcs_set_glyph_v_kerning_func (funcs, hb_ft_get_glyph_v_kerning, NULL, NULL);
397 hb_font_funcs_set_glyph_extents_func (funcs, hb_ft_get_glyph_extents, NULL, NULL); 418 hb_font_funcs_set_glyph_extents_func (funcs, hb_ft_get_glyph_extents, NULL, NULL);
398 hb_font_funcs_set_glyph_contour_point_func (funcs, hb_ft_get_glyph_contour_p oint, NULL, NULL); 419 hb_font_funcs_set_glyph_contour_point_func (funcs, hb_ft_get_glyph_contour_p oint, NULL, NULL);
399 hb_font_funcs_set_glyph_name_func (funcs, hb_ft_get_glyph_name, NULL, NULL); 420 hb_font_funcs_set_glyph_name_func (funcs, hb_ft_get_glyph_name, NULL, NULL);
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 0, font->y_scale < 0 ? -1 : +1}; 678 0, font->y_scale < 0 ? -1 : +1};
658 FT_Set_Transform (ft_face, &matrix, NULL); 679 FT_Set_Transform (ft_face, &matrix, NULL);
659 } 680 }
660 681
661 ft_face->generic.data = blob; 682 ft_face->generic.data = blob;
662 ft_face->generic.finalizer = (FT_Generic_Finalizer) _release_blob; 683 ft_face->generic.finalizer = (FT_Generic_Finalizer) _release_blob;
663 684
664 _hb_ft_font_set_funcs (font, ft_face, true); 685 _hb_ft_font_set_funcs (font, ft_face, true);
665 hb_ft_font_set_load_flags (font, FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING); 686 hb_ft_font_set_load_flags (font, FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING);
666 } 687 }
OLDNEW
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-ft.h ('k') | third_party/harfbuzz-ng/src/hb-glib.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698