static int FontFace_ParseFontWeight(LCUI_CSSFontFace face, const char *str) { int weight; if (ParseFontWeight(str, &weight)) { face->font_weight = weight; return 0; } return -1; }
static void AddStyleProp(Style* style, TxtNode* prop) { AutoFree tmp(prop->ValDup()); if (prop->IsTextWithKey("name")) { style->SetName(tmp); return; } if (prop->IsTextWithKey("bg_col")) { style->Set(Prop::AllocColorSolid(PropBgColor, tmp)); return; } if (prop->IsTextWithKey("col")) { style->Set(Prop::AllocColorSolid(PropColor, tmp)); return; } if (prop->IsTextWithKey("parent")) { Style* parentStyle = StyleByName(tmp); CrashIf(!parentStyle); style->SetInheritsFrom(parentStyle); return; } if (prop->IsTextWithKey("border_width")) { style->SetBorderWidth(ParseFloat(tmp)); return; } if (prop->IsTextWithKey("padding")) { ParsedPadding padding = {0}; ParsePadding(tmp, padding); style->SetPadding(padding.top, padding.right, padding.bottom, padding.left); return; } if (prop->IsTextWithKey("stroke_width")) { style->Set(Prop::AllocWidth(PropStrokeWidth, ParseFloat(tmp))); return; } if (prop->IsTextWithKey("fill")) { style->Set(Prop::AllocColorSolid(PropFill, tmp)); return; } if (prop->IsTextWithKey("vert_align")) { style->Set(Prop::AllocAlign(PropVertAlign, ParseElAlign(tmp))); return; } if (prop->IsTextWithKey("text_align")) { style->Set(Prop::AllocTextAlign(ParseAlignAttr(tmp))); return; } if (prop->IsTextWithKey("font_size")) { style->Set(Prop::AllocFontSize(ParseFloat(tmp))); return; } if (prop->IsTextWithKey("font_weight")) { style->Set(Prop::AllocFontWeight(ParseFontWeight(tmp))); return; } CrashIf(true); }