Fixed curly quotes after parenthesis: ("

Font size is now independent of screen DPI, at least on windows

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@478 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-07-04 14:50:44 +00:00
parent af008b4852
commit b91dd379cf
2 changed files with 15 additions and 7 deletions
+13 -4
View File
@@ -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) {
+2 -3
View File
@@ -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);