.uppbox: FontMaps

git-svn-id: svn://ultimatepp.org/upp/trunk@9159 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2015-11-07 09:01:50 +00:00
parent bf542cb63b
commit e3458c5d60
3 changed files with 46 additions and 0 deletions

View file

@ -0,0 +1,9 @@
uses
CtrlLib;
file
main.cpp;
mainconfig
"" = "GUI";

4
uppbox/FontMaps/init Normal file
View file

@ -0,0 +1,4 @@
#ifndef _FontMaps_icpp_init_stub
#define _FontMaps_icpp_init_stub
#include "CtrlLib/init"
#endif

33
uppbox/FontMaps/main.cpp Normal file
View file

@ -0,0 +1,33 @@
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
GUI_APP_MAIN
{
Progress pi;
pi.SetTotal(Font::GetFaceCount());
for(int i = 0; i < Font::GetFaceCount(); i++) {
String f = Font::GetFaceName(i);
pi.SetText(f);
if(pi.StepCanceled())
break;
Font fnt;
fnt.FaceName(f);
dword l = 0;
for(int ch = 32; ch < 4096; ch++) {
if(GetGlyphInfo(fnt, ch).IsNormal()) {
l |= (0x80000000 >> (ch / 128));
ch = (ch + 127) & ~127;
}
}
dword h = 0;
for(int ch = 32; ch < 65536; ch++) {
if(GetGlyphInfo(fnt, ch).IsNormal()) {
h |= (0x80000000 >> (ch / 2048));
ch = (ch + 2047) & ~2047;
}
}
LOG("{ " << AsCString(f) << ", 0x" << FormatIntHex(l) << ", 0x" << FormatIntHex(h) << " },");
}
PromptOK("OK");
}