PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Tue Mar 19, 2024 6:42 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Tue Jul 07, 2009 12:26 am 
Offline

Joined: Tue Jul 07, 2009 12:17 am
Posts: 6
When will support for simulated bold be available? How might this be accomplished?

PdfContentWriter.cs (235):
//if (bold && !descriptor.IsBoldFace)
//{
// // TODO: emulate bold by thicker outline
//}

//if (italic && !descriptor.IsBoldFace)
//{
// // TODO: emulate italic by shearing transformation
//}


Top
 Profile  
Reply with quote  
PostPosted: Tue Jul 07, 2009 11:43 pm 
Offline

Joined: Tue Jul 07, 2009 12:17 am
Posts: 6
Update: Here's the code in XGraphicsPdfRenderer which will simulate bold, because windows will create the font simulation when it generates the path:

if (bold && !descriptor.IsBoldFace)
{
// TODO: emulate bold by thicker outline --- DONE!
XGraphicsPath path = new XGraphicsPath();
path.AddString(s, font.FontFamily, font.Style,
font.Size, rect,
format);
XSolidBrush fontBrush = (XSolidBrush)brush;

gfx.DrawPath(brush, path);
return;
}


Top
 Profile  
Reply with quote  
PostPosted: Tue Apr 23, 2013 6:32 am 
Offline

Joined: Fri Mar 22, 2013 1:27 am
Posts: 4
If you want to keep the text as selectable text instead of a graphic you can also do the following:

//XGraphicsPdfRenderer.cs line 504
if (bold && !descriptor.IsBoldFace)
{
byte[] bytes = PdfEncoders.WinAnsiEncoding.GetBytes( s );
XPoint pos = new XPoint( x + 0.5, y );
AdjustTextMatrix( ref pos );
AppendFormat(
"{0:0.####} {1:0.####} Td {2} Tj\n", pos.x, pos.y,
PdfEncoders.ToStringLiteral( bytes, false, null ) );
}


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group