Skip to content

Instantly share code, notes, and snippets.

@sorbits
Created August 24, 2016 18:05
Show Gist options
  • Save sorbits/057937a37c86a43d86d44f69a75fa23f to your computer and use it in GitHub Desktop.
Save sorbits/057937a37c86a43d86d44f69a75fa23f to your computer and use it in GitHub Desktop.
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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment