Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
Yoda  
#1 Posted : Thursday, June 8, 2006 7:11:20 PM(UTC)
Yoda

Rank: Member

Groups: Member
Joined: 6/8/2006(UTC)
Posts: 1

Hi,

is there anybody who can help me (giving me an example) of the use of this two properties : Kernings and FontTracking ?

Thanks for your replies

Andrew  
#2 Posted : Monday, June 12, 2006 10:27:58 PM(UTC)
Andrew

Rank: Advanced Member

Groups: Member, Administration
Joined: 8/2/2003(UTC)
Posts: 876

Thanks: 2 times
Was thanked: 27 time(s) in 27 post(s)
First of all, both these properties work with DrawArtisticText only.

The usage is quite simple. If you want to increase spacing between all characters, you set FontTracking property to some positive value. This value is measured relatively the EmSquare value returned from TextFormat (roughly speaking, if FontTracking = EmSquare, the distance between characters will equal to the width of a character).

Here is an example:

Code:
Dim strString
strString = "Test"

Dim objBitmap
Set objBitmap = Server.CreateObject("GraphicsMill.Bitmap")
objBitmap.CreateNew 300, 150, Format24bppRgb, ColorRed

With objBitmap.Graphics
.Engine = DrawingEngineGdiplus
.Antialiasing = true
.TextFormat.FontName = "Verdana"
.TextFormat.FontTracking = 750
.Brush.PrimaryColor = .Color.CreateRGB(73, 1, 73)
.Pen.ForeColor = .Color.CreateRGB(73, 1, 73)
.TextFormat.FontSize = 48
.DrawArtisticText strString, 10, 30, true, false
End With

objBitmap.SaveToStream Response
Set objBitmap = Nothing

Edited by user Wednesday, December 19, 2007 4:21:47 PM(UTC)  | Reason: Not specified

Andrew  
#3 Posted : Monday, June 12, 2006 10:42:48 PM(UTC)
Andrew

Rank: Advanced Member

Groups: Member, Administration
Joined: 8/2/2003(UTC)
Posts: 876

Thanks: 2 times
Was thanked: 27 time(s) in 27 post(s)
Kernings array does the same but for each individual pair of characters in the string. The first entry in the array specifies an additional distance between first and second character in the string, the second entry - between the second and third character, etc.

You can set both positive and negative values.

Code:
Dim strString
strString = "Test"

Dim objBitmap
Set objBitmap = Server.CreateObject("GraphicsMill.Bitmap")
objBitmap.CreateNew 300, 150, Format24bppRgb, ColorRed

With objBitmap.Graphics
.Engine = DrawingEngineGdiplus
.Antialiasing = true
.TextFormat.FontName = "Verdana"
.TextFormat.FontTracking = 750
.Brush.PrimaryColor = .Color.CreateRGB(73, 1, 73)
.Pen.ForeColor = .Color.CreateRGB(73, 1, 73)

.TextFormat.Kernings = Array(.TextFormat.EmSquare/2, -400, 0)
.TextFormat.FontSize = 48
.DrawArtisticText strString, 10, 30, true, false
End With

objBitmap.SaveToStream Response
Set objBitmap = Nothing

Edited by user Wednesday, December 19, 2007 4:22:11 PM(UTC)  | Reason: Not specified

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.