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

Function PiuPort_measureString

modules/piu/All/piuPort.c:379–394  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

377}
378
379void PiuPort_measureString(xsMachine* the)
380{
381 xsSlot* string;
382 PiuStyle* style;
383 PiuDimension w, h;
384 (void)xsToString(xsArg(0));
385 string = &xsArg(0);
386 style = PIU(Style, xsArg(1));
387 if ((*style)->font == NULL)
388 PiuStyleLookupFont(style);
389 w = PiuFontGetWidth((*style)->font, string, 0, -1);
390 h = PiuFontGetHeight((*style)->font);
391 xsResult = xsNewObject();
392 xsDefine(xsResult, xsID_width, xsPiuDimension(w), xsDefault);
393 xsDefine(xsResult, xsID_height, xsPiuDimension(h), xsDefault);
394}

Callers

nothing calls this directly

Calls 3

PiuStyleLookupFontFunction · 0.50
PiuFontGetWidthFunction · 0.50
PiuFontGetHeightFunction · 0.50

Tested by

no test coverage detected