[futurebasic] Re: [FB] Core Grafics text fonts

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 2009 : Group Archive : Group : All Groups

From: Robert Purves <listrp@...>
Date: Mon, 26 Jan 2009 21:41:49 +1300
Piet en Claudine wrote:

> Can someone tell how fonts can be choosen if using Core Grafic text ?
> Fonttype = "Helvetica"
> Fonttype = "Helvetica-Bold"
> Works fine,
> But how  for instance ‘Italic’ is to be entered ? Or combinations  
> like Bold Italic ?


include "Tlbx CoreGraphics.incl"

dim as Str255       fontName, txt
dim as CGrafPtr     port
dim as CGContextRef ctx

window 1
GetPort( @port )
fn QDBeginCGContext( port, @ctx )
fontName = "Helvetica Bold Oblique"
fn FBPStr2CStr( @fontName )
CGContextSelectFont( ctx, @fontName, 24, _kCGEncodingMacRoman )
txt = "asdfghjklqwertyuiop"
CGContextShowTextAtPoint( ctx, 40, 170, @txt[1], txt[0] )
CGContextSynchronize( ctx )
fn QDEndCGContext( port, @ctx )

do
HandleEvents
until gFBQuit

Robert P.