| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright © 2011,2012 Google, Inc. | 2 * Copyright © 2011,2012 Google, Inc. |
| 3 * | 3 * |
| 4 * This is part of HarfBuzz, a text shaping library. | 4 * This is part of HarfBuzz, a text shaping library. |
| 5 * | 5 * |
| 6 * Permission is hereby granted, without written agreement and without | 6 * Permission is hereby granted, without written agreement and without |
| 7 * license or royalty fees, to use, copy, modify, and distribute this | 7 * license or royalty fees, to use, copy, modify, and distribute this |
| 8 * software and its documentation for any purpose, provided that the | 8 * software and its documentation for any purpose, provided that the |
| 9 * above copyright notice and the following two paragraphs appear in | 9 * above copyright notice and the following two paragraphs appear in |
| 10 * all copies of this software. | 10 * all copies of this software. |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 case t::SPACE_EM_16: | 519 case t::SPACE_EM_16: |
| 520 pos[i].x_advance = (font->x_scale + ((int) space_type)/2) / (int) spac
e_type; | 520 pos[i].x_advance = (font->x_scale + ((int) space_type)/2) / (int) spac
e_type; |
| 521 break; | 521 break; |
| 522 | 522 |
| 523 case t::SPACE_4_EM_18: | 523 case t::SPACE_4_EM_18: |
| 524 pos[i].x_advance = font->x_scale * 4 / 18; | 524 pos[i].x_advance = font->x_scale * 4 / 18; |
| 525 break; | 525 break; |
| 526 | 526 |
| 527 case t::SPACE_FIGURE: | 527 case t::SPACE_FIGURE: |
| 528 for (char u = '0'; u <= '9'; u++) | 528 for (char u = '0'; u <= '9'; u++) |
| 529 » if (font->get_glyph (u, 0, &glyph)) | 529 » if (font->get_nominal_glyph (u, &glyph)) |
| 530 { | 530 { |
| 531 pos[i].x_advance = font->get_glyph_h_advance (glyph); | 531 pos[i].x_advance = font->get_glyph_h_advance (glyph); |
| 532 break; | 532 break; |
| 533 } | 533 } |
| 534 break; | 534 break; |
| 535 | 535 |
| 536 case t::SPACE_PUNCTUATION: | 536 case t::SPACE_PUNCTUATION: |
| 537 » if (font->get_glyph ('.', 0, &glyph)) | 537 » if (font->get_nominal_glyph ('.', &glyph)) |
| 538 pos[i].x_advance = font->get_glyph_h_advance (glyph); | 538 pos[i].x_advance = font->get_glyph_h_advance (glyph); |
| 539 » else if (font->get_glyph (',', 0, &glyph)) | 539 » else if (font->get_nominal_glyph (',', &glyph)) |
| 540 pos[i].x_advance = font->get_glyph_h_advance (glyph); | 540 pos[i].x_advance = font->get_glyph_h_advance (glyph); |
| 541 break; | 541 break; |
| 542 | 542 |
| 543 case t::SPACE_NARROW: | 543 case t::SPACE_NARROW: |
| 544 /* Half-space? | 544 /* Half-space? |
| 545 * Unicode doc http://www.unicode.org/charts/PDF/U2000.pdf says ~1/4 o
r 1/5 of EM. | 545 * Unicode doc http://www.unicode.org/charts/PDF/U2000.pdf says ~1/4 o
r 1/5 of EM. |
| 546 * However, in my testing, many fonts have their regular space being a
bout that | 546 * However, in my testing, many fonts have their regular space being a
bout that |
| 547 * size. To me, a percentage of the space width makes more sense. Ha
lf is as | 547 * size. To me, a percentage of the space width makes more sense. Ha
lf is as |
| 548 * good as any. */ | 548 * good as any. */ |
| 549 pos[i].x_advance /= 2; | 549 pos[i].x_advance /= 2; |
| 550 break; | 550 break; |
| 551 } | 551 } |
| 552 } | 552 } |
| 553 } | 553 } |
| OLD | NEW |