PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index PDFsharp - moved to http://forum.pdfsharp.net/
Please visit the new PDFsharp forum at http://forum.pdfsharp.net/
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Bug solved for style font Bold, Italic and BoldItalic!!!

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Bug Reports - moved to http://forum.pdfsharp.net/
View previous topic :: View next topic  
Author Message
Vyacheslav Popov



Joined: 23 Nov 2007
Posts: 18

PostPosted: Mon Dec 17, 2007 6:04 pm    Post subject: Bug solved for style font Bold, Italic and BoldItalic!!! Reply with quote

Bug solved for style font Bold, Italic and BoldItalic!!!

File: PdfFontTable.cs
Class: PdfSharp.Pdf.Advanced.PdfFontTable.FontSelector
Method: Constructor
Line: 208

UPDATED Very Happy
Code:

      public FontSelector(XFont font)
      {
        this.name = font.Name;
        // Ignore Strikeout and Underline
        if (font.FontFamily.IsStyleAvailable(XFontStyle.Bold & XFontStyle.Italic))
            this.style = XFontStyle.Regular;
        else if (font.FontFamily.IsStyleAvailable(XFontStyle.Bold))
            this.style = XFontStyle.Bold;
        else if (font.FontFamily.IsStyleAvailable(XFontStyle.Italic))
            this.style = XFontStyle.Italic;
        else
            this.style = XFontStyle.BoldItalic;

        this.fontType = font.Unicode ? FontType.Type0 : FontType.TrueType;
      }


ORIGINAL WITH BUG Sad
Code:

      public FontSelector(XFont font)
      {
        this.name = font.Name;
        // Ignore Strikeout and Underline
        this.style = font.Style & (XFontStyle.Bold | XFontStyle.Italic);
        // Clear styles that are not available to prevent embedding of identical font files
        if ((this.style & XFontStyle.Bold) == XFontStyle.Bold && !font.FontFamily.IsStyleAvailable(XFontStyle.Bold))
          this.style &= ~XFontStyle.Bold;
        if ((this.style & XFontStyle.Italic) == XFontStyle.Italic && !font.FontFamily.IsStyleAvailable(XFontStyle.Italic))
          this.style &= ~XFontStyle.Italic;

        this.fontType = font.Unicode ? FontType.Type0 : FontType.TrueType;
      }
Back to top
View user's profile Send private message Visit poster's website
Thomas Hoevel



Joined: 16 Oct 2006
Posts: 387
Location: Cologne, Germany

PostPosted: Tue Dec 18, 2007 10:39 am    Post subject: Re: Bug solved for style font Bold, Italic and BoldItalic!!! Reply with quote

Vyacheslav Popov wrote:
Bug solved for style font Bold, Italic and BoldItalic!!!
Code:

[...]
        if (font.FontFamily.IsStyleAvailable(XFontStyle.Bold & XFontStyle.Italic))
            this.style = XFontStyle.Regular;
[...]


Is it a bug or a feature? You set Regular if Bold and Italic are available? Or is there a "!" missing? Or do we have to swap "Regular" and "BoldItalic"?
_________________
Regards
Thomas Hoevel
PDFsharp Team
Back to top
View user's profile Send private message Visit poster's website
Vyacheslav Popov



Joined: 23 Nov 2007
Posts: 18

PostPosted: Tue Dec 18, 2007 11:21 am    Post subject: Reply with quote

Yes, Is bug... but, this bug is of GDI+ framework or Microsoft example error
I check state of diferent fonts family, and result is:


Font1: Regular
FontStyle.Bold = true
FontStyle.Italic = true
FontStyle.Regular = true

Font2: Bold
FontStyle.Bold = true
FontStyle.Italic = false
FontStyle.Regular = false

Font3: Italic
FontStyle.Bold = false
FontStyle.Italic = true
FontStyle.Regular = false

Font4: BoldItalic
FontStyle.Bold = false
FontStyle.Italic = false
FontStyle.Regular = false

Therefore, the condition changes and example of microsoft is FAIL
http://msdn2.microsoft.com/en-us/library/y505zzfw(VS.80).aspx
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Bug Reports - moved to http://forum.pdfsharp.net/ All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © phpBB Group. Hosted by phpBB.BizHat.com


Start Your Own YouTube Clone

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!
For Support, visit Forums.BizHat.com