From 92f95bc62d43dfbc34edb28dc537da9d1dfa7b23 Mon Sep 17 00:00:00 2001 From: cxl Date: Thu, 21 May 2009 21:39:49 +0000 Subject: [PATCH] Developing font metrics git-svn-id: svn://ultimatepp.org/upp/trunk@1215 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppdev/FontMetrics/FontMetrics.upp | 9 +++++ uppdev/FontMetrics/main.cpp | 63 ++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 uppdev/FontMetrics/FontMetrics.upp create mode 100644 uppdev/FontMetrics/main.cpp diff --git a/uppdev/FontMetrics/FontMetrics.upp b/uppdev/FontMetrics/FontMetrics.upp new file mode 100644 index 000000000..5872304d3 --- /dev/null +++ b/uppdev/FontMetrics/FontMetrics.upp @@ -0,0 +1,9 @@ +uses + CtrlLib; + +file + main.cpp; + +mainconfig + "" = "GUI"; + diff --git a/uppdev/FontMetrics/main.cpp b/uppdev/FontMetrics/main.cpp new file mode 100644 index 000000000..de032d2ab --- /dev/null +++ b/uppdev/FontMetrics/main.cpp @@ -0,0 +1,63 @@ +#include + +using namespace Upp; + +struct CharMetrics { + int16 width; + int16 lspc; + int16 rspc; +}; + +struct FontMetrics { + int refcount; + Font font; + int angle; + int device; + #ifdef PLATFORM_WIN32 + HFONT hfont; + #endif + #ifdef PLATFORM_XFT + XftFont *xftfont; + XftFont *xftfont0; + #endif + int ascent; + int descent; + int external; + int internal; + int height; + int lineheight; + int overhang; + Size offset; + int avewidth; + int maxwidth; + int firstchar; + int charcount; + int default_char; + + CharMetrics *base[64]; + + Mutex xmutex; + Vector kinfo; + VectorMap xx; + + bool fixedpitch; + bool scaleable; + int spacebefore; + int spaceafter; + #ifdef PLATFORM_X11 + int underline_position; + int underline_thickness; + double sina; + double cosa; + bool twobyte; + String filename; + #endif +}; + +FontMetrics GetFontMetrics(Font fnt); +CharMetrics GetCharMetrics(Font fnt, int chr); + +GUI_APP_MAIN +{ +} +