RichText: '[g ' now sets standard GUI font with *standard size*

git-svn-id: svn://ultimatepp.org/upp/trunk@7619 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-08-29 11:07:07 +00:00
parent 1ecfcf5258
commit 8f28c30c7b
3 changed files with 24 additions and 0 deletions

View file

@ -50,6 +50,8 @@ void RichPara::Flush(Draw& draw, const PaintInfo& pi, wchar *text,
draw.DrawRect(zx0, z * y, width, z * (y + linecy) - z * y,
pi.coloroverride ? SColorPaper() : f.paper);
Font fnt = f;
DDUMP(fnt.GetFaceName());
DDUMP(fnt.GetCy());
int zht = z * tabs(f.GetHeight());
int ssa = 0;
int ssd = 0;

View file

@ -550,6 +550,22 @@ void RichQtfParser::Cat(int chr)
extern bool s_nodeqtf[128];
int GetRichTextScreenStdFontHeight()
{
static int gh = 67;
ONCELOCK {
for(int i = 0; i < 1000; i++) {
int h = GetRichTextStdScreenZoom() * i;
LOG(i << ' ' << StdFont(h).GetCy());
if(h > 0 && StdFont(h).GetCy() == StdFont().GetCy()) {
gh = i;
break;
}
}
}
return gh;
}
void RichQtfParser::Parse(const char *qtf, int _accesskey)
{
accesskey = _accesskey;
@ -661,6 +677,10 @@ void RichQtfParser::Parse(const char *qtf, int _accesskey)
}
break;
}
case 'g':
format.Face(Font::STDFONT);
format.Height(GetRichTextScreenStdFontHeight());
break;
default:
if(c >= '0' && c <= '9') {
format.Height(QTFFontHeight[c - '0']);

View file

@ -227,6 +227,8 @@ matching&]
::= [s0; Courier font.]
::^ [s0;%- [C@(128.0.255) G]]
::= [s0; Standard GUI font.]
::^ [s0;%- [C@(128.0.255) g]]
::= [s0; Standard GUI font with standard height.]
::^ [s0;%- [C@(128.0.255) S]]
::= [s0; Symbol font.]
::^ [s0;%- [C@(128.0.255) .][/C@(0.0.255) number]]