new structs in font rendering

db4
Doug Coleman 2009-08-29 14:29:46 -05:00
parent 56be96429a
commit 6aeb3614ff
3 changed files with 61 additions and 60 deletions

View File

@ -31,7 +31,7 @@ MEMO:: (cache-font) ( font -- HFONT )
: TEXTMETRIC>metrics ( TEXTMETRIC -- metrics )
[ metrics new 0 >>width ] dip {
[ TEXTMETRICW-tmHeight >>height ]
[ TEXTMETRICW-tmAscent >>ascent ]
[ TEXTMETRICW-tmDescent >>descent ]
[ tmHeight>> >>height ]
[ tmAscent>> >>ascent ]
[ tmDescent>> >>descent ]
} cleave ;

View File

@ -380,26 +380,26 @@ TYPEDEF: DWORD* LPCOLORREF
: color>RGB ( color -- COLORREF )
>rgba-components drop [ 255 * >integer ] tri@ RGB ;
C-STRUCT: TEXTMETRICW
{ "LONG" "tmHeight" }
{ "LONG" "tmAscent" }
{ "LONG" "tmDescent" }
{ "LONG" "tmInternalLeading" }
{ "LONG" "tmExternalLeading" }
{ "LONG" "tmAveCharWidth" }
{ "LONG" "tmMaxCharWidth" }
{ "LONG" "tmWeight" }
{ "LONG" "tmOverhang" }
{ "LONG" "tmDigitizedAspectX" }
{ "LONG" "tmDigitizedAspectY" }
{ "WCHAR" "tmFirstChar" }
{ "WCHAR" "tmLastChar" }
{ "WCHAR" "tmDefaultChar" }
{ "WCHAR" "tmBreakChar" }
{ "BYTE" "tmItalic" }
{ "BYTE" "tmUnderlined" }
{ "BYTE" "tmStruckOut" }
{ "BYTE" "tmPitchAndFamily" }
{ "BYTE" "tmCharSet" } ;
STRUCT: TEXTMETRICW
{ tmHeight LONG }
{ tmAscent LONG }
{ tmDescent LONG }
{ tmInternalLeading LONG }
{ tmExternalLeading LONG }
{ tmAveCharWidth LONG }
{ tmMaxCharWidth LONG }
{ tmWeight LONG }
{ tmOverhang LONG }
{ tmDigitizedAspectX LONG }
{ tmDigitizedAspectY LONG }
{ tmFirstChar WCHAR }
{ tmLastChar WCHAR }
{ tmDefaultChar WCHAR }
{ tmBreakChar WCHAR }
{ tmItalic BYTE }
{ tmUnderlined BYTE }
{ tmStruckOut BYTE }
{ tmPitchAndFamily BYTE }
{ tmCharSet BYTE } ;
TYPEDEF: TEXTMETRICW* LPTEXTMETRIC

View File

@ -4,7 +4,8 @@ USING: kernel assocs math sequences fry io.encodings.string
io.encodings.utf16n accessors arrays combinators destructors
cache namespaces init fonts alien.c-types windows.usp10
windows.offscreen windows.gdi32 windows.ole32 windows.types
windows.fonts opengl.textures locals windows.errors ;
windows.fonts opengl.textures locals windows.errors
classes.struct ;
IN: windows.uniscribe
TUPLE: script-string < disposable font string metrics ssa size image ;
@ -84,7 +85,7 @@ TUPLE: script-string < disposable font string metrics ssa size image ;
[ SIZE-cx ] [ SIZE-cy ] bi 2array ;
: dc-metrics ( dc -- metrics )
"TEXTMETRICW" <c-object>
TEXTMETRICW <struct>
[ GetTextMetrics drop ] keep
TEXTMETRIC>metrics ;