parse embedded font
| 3553 | |
| 3554 | // parse embedded font |
| 3555 | static void nsvg__parseFont(NSVGparser* p, const char** dict) |
| 3556 | { |
| 3557 | int i; |
| 3558 | NSVGfont* font; |
| 3559 | NSVGattrib* curAttr = nsvg__getAttr(p); |
| 3560 | if (!curAttr) { |
| 3561 | return; |
| 3562 | } |
| 3563 | |
| 3564 | font = (__typeof__(font))AllocateZeroPool(sizeof(*font)); |
| 3565 | |
| 3566 | for (i = 0; dict[i]; i += 2) { |
| 3567 | if (strcmp(dict[i], "horiz-adv-x") == 0) { |
| 3568 | font->horizAdvX = (int)AsciiStrDecimalToUintn(dict[i+1]); |
| 3569 | } else if (strcmp(dict[i], "font-family") == 0) { //usually absent here |
| 3570 | AsciiStrCpyS(font->fontFamily, kMaxIDLength, dict[i+1]); |
| 3571 | } else { |
| 3572 | nsvg__parseAttr(p, dict[i], dict[i + 1]); |
| 3573 | } |
| 3574 | } |
| 3575 | |
| 3576 | AsciiStrCpyS(font->id, kMaxIDLength, curAttr->id); |
| 3577 | if (!font->horizAdvX) { |
| 3578 | font->horizAdvX = 1000; |
| 3579 | } |
| 3580 | DBG("found font id=%s family=%s\n", font->id, font->fontFamily); |
| 3581 | |
| 3582 | NSVGfontChain* fontChain = (__typeof__(fontChain))AllocatePool(sizeof(*fontChain)); |
| 3583 | fontChain->font = font; |
| 3584 | fontChain->next = fontsDB; |
| 3585 | p->font = font; |
| 3586 | |
| 3587 | fontsDB = fontChain; |
| 3588 | } |
| 3589 | |
| 3590 | static void nsvg__parseFontFace(NSVGparser* p, const char** dict) |
| 3591 | { |
no test coverage detected