MCPcopy Create free account
hub / github.com/NanoMichael/MicroTeX / getLength

Method getLength

src/atom/atom_basic.cpp:211–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209}
210
211pair<int, float> SpaceAtom::getLength(const string& lgth) {
212 if (lgth.empty()) return pair<int, float>({UNIT_PIXEL, 0.f});
213
214 size_t i = 0;
215 for (; i < lgth.size() && !isalpha(lgth[i]); i++)
216 ;
217 float f = 0;
218 valueof(lgth.substr(0, i), f);
219
220 int unit = UNIT_PIXEL;
221 string x = lgth.substr(i);
222 tolower(x);
223 if (i != lgth.size()) unit = getUnit(x);
224
225 return pair<int, float>({unit, f});
226}
227
228pair<int, float> SpaceAtom::getLength(const wstring& lgth) {
229 string s;

Callers

nothing calls this directly

Calls 3

valueofFunction · 0.85
getUnitFunction · 0.85
wide2utf8Function · 0.85

Tested by

no test coverage detected