From 77d8f389168c8edb1cd5ec8ae53f19b9019a9714 Mon Sep 17 00:00:00 2001 From: cxl Date: Mon, 3 May 2010 10:31:18 +0000 Subject: [PATCH] uppbox: FontCover utility git-svn-id: svn://ultimatepp.org/upp/trunk@2355 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppbox/FontCover/FontCover.upp | 11 ++++++++ uppbox/FontCover/main.cpp | 50 ++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 uppbox/FontCover/FontCover.upp create mode 100644 uppbox/FontCover/main.cpp diff --git a/uppbox/FontCover/FontCover.upp b/uppbox/FontCover/FontCover.upp new file mode 100644 index 000000000..5762f0478 --- /dev/null +++ b/uppbox/FontCover/FontCover.upp @@ -0,0 +1,11 @@ +description "Font character coverage generator\377"; + +uses + CtrlLib; + +file + main.cpp; + +mainconfig + "" = "GUI"; + diff --git a/uppbox/FontCover/main.cpp b/uppbox/FontCover/main.cpp new file mode 100644 index 000000000..3ea2bb755 --- /dev/null +++ b/uppbox/FontCover/main.cpp @@ -0,0 +1,50 @@ +#include + +using namespace Upp; + +const char *font[] = { + "sans-serif", + "Arial", + "Arial Unicode MS", + "MS UI Gothic", + "MS Mincho", + "Arial", + "AlArabiya" + "FreeSerif", + "Kochi Mincho", + "Kochi Gothic", + "Sazanami Mincho", + "Sazanami Gothic", + "Gulim", + "SimSun", + "PMingLiU", + "Symbol", +}; + +GUI_APP_MAIN +{ + Progress pi("Font %d"); + for(int i = 0; i < __countof(font); i++) { + if(pi.StepCanceled()) + return; + Font fnt; + if(Font::FindFaceNameIndex(font[i]) > 0) { + fnt.FaceName(font[i]); + dword l = 0; + for(int ch = 32; ch < 4096; ch++) { + if(GetGlyphInfo(fnt, ch).IsNormal()) { + l |= (0x80000000 >> (ch >> 7)); + ch |= 127; + } + } + dword h = 0; + for(int ch = 32; ch < 65536; ch++) { + if(GetGlyphInfo(fnt, ch).IsNormal()) { + h |= (0x8000000 >> ((dword)ch >> 11)); + ch |= 2047; + } + } + LOG(AsCString(font[i]) << ", 0x" << FormatIntHex(l) << ", 0x" << FormatIntHex(h) << ','); + } + } +}