Results 1 to 4 of 4

Thread: How to verify the validity of opentyoe or truetype fonts?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2011
    Posts
    4
    Qt products
    PyQt3 PyQt4

    Default How to verify the validity of opentyoe or truetype fonts?

    Hi all,

    I have a Qt application that requires me to validate the font resources. Basically I have a file ex font.ttf or font.otf that I would like to load in Qt and see if it's a valid file.

    Basically my validation I think would need to consist of the following,
    1) load the font resource (load face)
    2) get the face properties
    3) create a glyph container for the loaded font resource
    4) see if I could load each glyph present and if failed then conclude that the font file is bad.

    Thanks

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: How to verify the validity of opentyoe or truetype fonts?

    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3
    Join Date
    Dec 2011
    Posts
    4
    Qt products
    PyQt3 PyQt4

    Default Re: How to verify the validity of opentyoe or truetype fonts?

    Thanks for the reply.

    I still can't find where in any of the ones you sent me, can I verify it's validity.

    I basically do not know how to verify it's validity even though I load it into QFont?
    The step example I wrote was one that I had retrieved from FreeType but I am trying
    not to include FreeType into my Qt program and see if I could use Qt build in functionalities
    to test a font.

    What I mean is, once I load my font file into QFont, by retrieving the info of the font using
    QFontInfo, is that sufficient enough to verify that the font file is valid?

    Thanks

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to verify the validity of opentyoe or truetype fonts?

    is that sufficient enough to verify that the font file is valid?
    No. The technical validity, i.e. adherence to standards, of a TrueType or OpenType font is different from the ability of Qt to use some or all of the features offered by the font. Qt is uses FreeType to handle fonts so there's a reasonable chance that a badly corrupted font won't load, but that does not mean everything contained within the font file is perfectly correct, checked, or used. FreeType won't use an OpenType Layout tables even if they are present. FreeType, like all other renderers, contends with (covers for) a range of minor malformations and ambiguities in fonts that arise from a variety of sources.

    There are dedicated tools out there for editing, validating and/or correcting fonts:
    Microsoft Font Validator
    Font Forge

    I believe you can script FontForge.
    Last edited by ChrisW67; 22nd April 2013 at 23:45. Reason: Fix fat-handed typing

Similar Threads

  1. How to sign and verify through Openssl
    By mania in forum General Discussion
    Replies: 5
    Last Post: 11th March 2013, 04:54
  2. Qt Platform Abstraction support for truetype fonts
    By Wotsgreen in forum Qt for Embedded and Mobile
    Replies: 2
    Last Post: 9th September 2012, 15:48
  3. Verify fields in QTableWidget are complete?
    By alitoh in forum Qt Programming
    Replies: 2
    Last Post: 18th May 2011, 13:49
  4. QModelIndex validity during beginRemoveRows
    By jkv in forum Qt Programming
    Replies: 4
    Last Post: 19th November 2010, 11:02
  5. Replies: 3
    Last Post: 1st September 2008, 23:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.