OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2009 Red Hat, Inc. | 2 * Copyright © 2009 Red Hat, Inc. |
3 * Copyright © 2011 Google, Inc. | 3 * Copyright © 2011 Google, Inc. |
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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 if (0 == strncmp (s, "uni", 3) && | 498 if (0 == strncmp (s, "uni", 3) && |
499 hb_codepoint_parse (s + 3, len - 3, 16, &unichar) && | 499 hb_codepoint_parse (s + 3, len - 3, 16, &unichar) && |
500 get_nominal_glyph (unichar, glyph)) | 500 get_nominal_glyph (unichar, glyph)) |
501 return true; | 501 return true; |
502 } | 502 } |
503 | 503 |
504 return false; | 504 return false; |
505 } | 505 } |
506 | 506 |
507 private: | 507 private: |
508 inline hb_position_t em_scale (int16_t v, int scale) { return (hb_position_t)
(v * (int64_t) scale / face->get_upem ()); } | 508 inline hb_position_t em_scale (int16_t v, int scale) |
| 509 { |
| 510 int upem = face->get_upem (); |
| 511 int64_t scaled = v * (int64_t) scale; |
| 512 scaled += scaled >= 0 ? upem/2 : -upem/2; /* Round. */ |
| 513 return (hb_position_t) (scaled / upem); |
| 514 } |
509 }; | 515 }; |
510 | 516 |
511 #define HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS | 517 #define HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS |
512 #define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_PROTOTYPE(shaper, font); | 518 #define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_PROTOTYPE(shaper, font); |
513 #include "hb-shaper-list.hh" | 519 #include "hb-shaper-list.hh" |
514 #undef HB_SHAPER_IMPLEMENT | 520 #undef HB_SHAPER_IMPLEMENT |
515 #undef HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS | 521 #undef HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS |
516 | 522 |
517 | 523 |
518 #endif /* HB_FONT_PRIVATE_HH */ | 524 #endif /* HB_FONT_PRIVATE_HH */ |
OLD | NEW |