MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / PiuFontGetWidthSubPixel

Function PiuFontGetWidthSubPixel

modules/piu/PC/lin/piuFont.c:69–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69double PiuFontGetWidthSubPixel(PiuFont* self, xsSlot* slot, xsIntegerValue offset, xsIntegerValue length)
70{
71 xsMachine* the = (*self)->the;
72 xsStringValue string = PiuToString(slot);
73 if (length < 0)
74 length = c_strlen(string + offset);
75 char* text = malloc(length + 1);
76 memcpy(text, string + offset, length);
77 text[length] = 0;
78 cairo_text_extents_t extents;
79 cairo_set_font_face(extents_cr, (*self)->face);
80 cairo_set_font_size(extents_cr, (*self)->size);
81 cairo_text_extents(extents_cr, text, &extents);
82 free(text);
83 return extents.x_advance;
84}
85
86void PiuFontMark(xsMachine* the, void* it, xsMarkRoot markRoot)
87{

Callers 2

PiuFontGetWidthFunction · 0.70
PiuCodeComputeStyleFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected