Commit 1f6decc4 authored by twanvl's avatar twanvl

Fixed curly quotes after parenthesis: ("

Font size is now independent of screen DPI, at least on windows
parent b328b16d
......@@ -73,18 +73,27 @@ wxFont Font::toWxFont(double scale) const {
int size_i = scale * size;
int weight_i = flags & FONT_BOLD ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL;
int style_i = flags & FONT_ITALIC ? wxFONTSTYLE_ITALIC : wxFONTSTYLE_NORMAL;
// make font
wxFont font;
if (flags & FONT_CODE) {
if (size_i < 2) size_i = wxNORMAL_FONT->GetPointSize();
return wxFont(size_i, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, weight_i, underline(), _("Courier New"));
font = wxFont(size_i, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, weight_i, underline(), _("Courier New"));
} else if (name().empty()) {
wxFont font = *wxNORMAL_FONT;
font = *wxNORMAL_FONT;
font.SetPointSize(size > 1 ? size_i : scale * font.GetPointSize());
return font;
} else if (flags & FONT_ITALIC && !italic_name().empty()) {
return wxFont(size_i, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, weight_i, underline(), italic_name());
font = wxFont(size_i, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, weight_i, underline(), italic_name());
} else {
return wxFont(size_i, wxFONTFAMILY_DEFAULT, style_i, weight_i, underline(), name());
font = wxFont(size_i, wxFONTFAMILY_DEFAULT, style_i, weight_i, underline(), name());
}
// fix size
#ifdef __WXMSW__
// make it independent of screen dpi, always use 96 dpi
// TODO: do something more sensible, and more portable
font.SetPixelSize(wxSize(0, -(int)(scale*size*96.0/72.0 + 0.5) ));
#endif
return font;
}
IMPLEMENT_REFLECTION_NO_SCRIPT(Font) {
......
......@@ -101,14 +101,13 @@ SCRIPT_FUNCTION(curly_quotes) {
c = open ? LEFT_SINGLE_QUOTE : RIGHT_SINGLE_QUOTE;
} else if (c == _('\"') || c == LEFT_DOUBLE_QUOTE || c == RIGHT_DOUBLE_QUOTE) {
c = open ? LEFT_DOUBLE_QUOTE : RIGHT_DOUBLE_QUOTE;
}
if (c == _('<')) {
} else if (c == _('<')) {
in_tag = true;
} else if (c == _('>')) {
in_tag = false;
} else if (!in_tag) {
// Also allow double-nesting of quotes
open = isSpace(c) || c == LEFT_DOUBLE_QUOTE || c == LEFT_SINGLE_QUOTE;
open = isSpace(c) || c == _('(') || c == _('[');
}
}
SCRIPT_RETURN(input);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment