Print Page | Close Window

Bold Font

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1009
Printed Date: 06 May 25 at 9:32AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Bold Font
Posted By: skwirelboy
Subject: Bold Font
Date Posted: 31 Jan 09 at 5:27AM
Hi,
 
 
Does anyone have a code sample to show how to set the font to bold, italic etc.
 
I need to get this working with the standard pdf fonts and also with added truetype fonts.
 
Have tried SetFontFlags, but can't get it to work. Posted a snippet of code I was using a few weeks ago, but nobody was able to correct it.
 
I can't believe that no-one out there has managed to set font to bold, italic etc for truetype fonts.
 
Thanks for any help.
 
Regards
 
Mark



Replies:
Posted By: Ingo
Date Posted: 31 Jan 09 at 7:02AM

Hi Mark!

I think you won't find an answer... I've used the search-function (here above) with "bold" ... and i've found your old postings in this case ;-)

Perhaps it's better to post your post and then the other ones here can say what's perhaps wrong with it.

Cheers, Ingo

 



Posted By: skwirelboy
Date Posted: 02 Feb 09 at 5:55AM
Hi Ingo,
 
I haven't been able to find an answer on the forum. But does this mean it can't be done or that no-one else has this problem.
 
Basically, if you add a truetype font how do you output the text for that font in bold or italics?
 
Does anyone know?
 
Thanks


Posted By: Ingo
Date Posted: 02 Feb 09 at 7:23AM

Perhaps it's better to post your code and then the other ones here can say what's perhaps wrong with it.



Posted By: skwirelboy
Date Posted: 02 Feb 09 at 7:27AM
Hi Ingo,
 
I have tried using setfontflags as recommended by another user in an earlier post. The code is:
 
id:=qp.AddTrueTypeFont(FontName, 1);
qp.SelectFont(id);
qp.SetFontFlags(0, 0, 0, 0, 1, 0, 0, 1); //ie bold italic
 
 
This makes no perceptible difference to the font whne drawn.
 
Thanks


Posted By: Ingo
Date Posted: 02 Feb 09 at 4:13PM
Hi Mark!
 
This is from the help-file.
Try a font family with bold or whatever you want.
 
Cheers, Ingo
 
Function AddTrueTypeFont(FontName As String,
                         Embed  As Long) As Long
Parameters
FontName The name of the TrueType font to install. This can either be the name of the font
as shown in the Windows\Fonts folder (for example "Times New Roman Bold") or
it can be the font family name with an optional style specifier in square brackets
(for example "Times New Roman [BoldItalic]"). Possible optional specifiers are:
[Bold], [Italic] or [BoldItalic]. A codepage can also be specified (for example "Arial
[Bold] {1250}") which allows other encodings to be used. The only codepages
supported at the moment are 437, 850, 852, 1250, 1251 and 1255.
Embed Specifies whether to embed the font or not:
0 = Don't embed the font.
1 = Embed the font.
Returns
0 The font could not be added. This may mean that the font is not licensed to be
embedded, or that the font could not be found.
Non-zero The ID of the font that was successfully added.


Posted By: skwirelboy
Date Posted: 04 Feb 09 at 7:52AM

Hi Ingo,

Works perfectly. Obviously helps to read the help file properly.

I will post a reply to the earlier thread just to point out that SetFontFlags is not the way to go.

 

Many thanks for your help.

 

Regards

 

MArk




Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk