Skip to content

Instantly share code, notes, and snippets.

@sorbits
Created August 24, 2016 18:05

Revisions

  1. sorbits created this gist Aug 24, 2016.
    12 changes: 12 additions & 0 deletions fontStyle.cc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    std::string fontStyle;
    if(plist::get_key_path(plist, "settings.fontStyle", fontStyle))
    {
    bool hasPlain = fontStyle.find("plain") != std::string::npos;
    bool hasBold = fontStyle.find("bold") != std::string::npos;
    bool hasItalic = fontStyle.find("italic") != std::string::npos;
    bool hasUnderline = fontStyle.find("underline") != std::string::npos;

    res.bold = hasBold ? bool_true : (hasPlain ? bool_false : bool_unset);
    res.italic = hasItalic ? bool_true : (hasPlain ? bool_false : bool_unset);
    res.underlined = hasUnderline ? bool_true : (hasPlain ? bool_false : bool_unset);
    }