From dec1c3cebd7ee677c5a1add098ea7515fc58da27 Mon Sep 17 00:00:00 2001 From: cxl Date: Sun, 25 Aug 2013 17:03:57 +0000 Subject: [PATCH] Draw: InvalidateFontList git-svn-id: svn://ultimatepp.org/upp/trunk@6271 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Draw/Font.cpp | 18 ++++++++++++------ uppsrc/Draw/FontInt.h | 2 ++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/uppsrc/Draw/Font.cpp b/uppsrc/Draw/Font.cpp index 84760bbf7..58a73a98b 100644 --- a/uppsrc/Draw/Font.cpp +++ b/uppsrc/Draw/Font.cpp @@ -18,15 +18,21 @@ INITBLOCK { Value::Register("Font"); } +static bool sListValid; + +void InvalidateFontList() +{ + sListValid = false; +} + const Vector& Font::List() { - static Vector *q; - ONCELOCK { - static Vector x; - x = GetAllFacesSys(); - q = &x; + static Vector list; + if(!sListValid) { + Set__(sListValid); + list = GetAllFacesSys(); } - return *q; + return list; } void sInitFonts() diff --git a/uppsrc/Draw/FontInt.h b/uppsrc/Draw/FontInt.h index dd6c23154..bea014e06 100644 --- a/uppsrc/Draw/FontInt.h +++ b/uppsrc/Draw/FontInt.h @@ -51,6 +51,8 @@ const CommonFontInfo& GetFontInfo(Font font); bool IsNormal(Font font, int chr); void GlyphMetrics(GlyphInfo& f, Font font, int chr); +void InvalidateFontList(); + // Platform specific font interface CommonFontInfo GetFontInfoSys(Font font);