Fixing richtextzoom #598

git-svn-id: svn://ultimatepp.org/upp/trunk@6640 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2013-12-04 12:26:14 +00:00
parent 5256bad75f
commit f611afa3c2
3 changed files with 25 additions and 4 deletions

View file

@ -134,8 +134,8 @@ void ChHostSkin()
}
}
Draw::SetStdFont(Font(fontname, (fontheight * xdpi + 512*72) / (1024*72))
.Bold(bold).Italic(italic));
Font::SetDefaultFont(Font(fontname, (fontheight * xdpi + 512*72) / (1024*72))
.Bold(bold).Italic(italic));
ClearFtFaceCache();

View file

@ -55,7 +55,9 @@ class Font : public ValueType<Font, FONT_V, Moveable<Font> >{
static Font AStdFont;
static Size StdFontSize;
static bool std_font_override;
static void SetStdFont0(Font font);
static Vector<FaceInfo>& FaceList();
static void SyncStdFont();
static void InitStdFont();
@ -79,6 +81,7 @@ public:
static dword GetFaceInfo(int index);
static void SetFace(int index, const String& name, dword info);
static void SetDefaultFont(Font font);
static void SetStdFont(Font font);
static Font GetStdFont();
static Size GetStdFontSize();

View file

@ -1,6 +1,6 @@
#include "Draw.h"
#define LLOG(x)
#define LLOG(x) // DLOG(x)
NAMESPACE_UPP
@ -115,7 +115,7 @@ void Font::SyncStdFont()
void (*whenSetStdFont)();
void Font::SetStdFont(Font font)
void Font::SetStdFont0(Font font)
{
LLOG("SetStdFont " << font);
Mutex::Lock __(sFontLock);
@ -124,18 +124,36 @@ void Font::SetStdFont(Font font)
x++;
InitStdFont();
AStdFont = font;
LLOG("AStdFont1: " << AStdFont);
SyncStdFont();
LLOG("AStdFont2: " << AStdFont);
if(whenSetStdFont)
(*whenSetStdFont)();
LLOG("AStdFont3: " << AStdFont);
x--;
static int w = 0;
if(w) return;
w++;
if(whenSetStdFont)
(*whenSetStdFont)();
LLOG("AStdFont4: " << AStdFont);
w--;
}
bool Font::std_font_override;
void Font::SetDefaultFont(Font font)
{
if(!std_font_override)
SetStdFont0(font);
}
void Font::SetStdFont(Font font)
{
std_font_override = true;
SetStdFont0(font);
}
void Font::InitStdFont()
{
ONCELOCK {