// This was added when font-family was stored as a string, but it is now stored as a FontID static void ParseString(const char* s, size_t len, StyleCategories cat, Doc* doc, Style& style) { char stat[64]; StyleAttrib attrib; if (len < sizeof(stat)) { memcpy(stat, s, len); stat[len] = 0; attrib.Set(cat, stat, doc); } else { String copy; copy.Set(s, len); attrib.Set(cat, copy.Z, doc); } style.Set(attrib); }
static bool ParseSingleAttrib(const char* s, size_t len, bool (*parseFunc)(const char* s, size_t len, T& t), StyleCategories cat, Style& style) { T val; if (parseFunc(s, len, val)) { StyleAttrib attrib; attrib.Set(cat, val); style.Set(attrib); return true; } else { ParseFail("Parse failed, unknown value: '%.*s'\n", (int) len, s); return false; } }