Obtaining the font sizes associated with a particular font.


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Obtaining the font sizes associated with a particular font.

Hybrid View

  1. #1
    Mike Turner Guest

    Obtaining the font sizes associated with a particular font.

    How does one obtain the font sizes associated with a given font?

    eg of sort of thing required:

    In a word processing programme you might have one drop-down list box
    containing the available fonts and another one that displays all the font
    sizes for the currently selected font.)

    Would be grateful for any advice,coding etc on this.Thanks a lot.

    Mike Turner.






  2. #2
    Peter Higgins Guest

    Re: Obtaining the font sizes associated with a particular font.


    Hi Mike;
    Welcome to the snake pit. You have a couple of options.

    One, use a system font dialog,

    two, if you need font information in the program logic, enumerate them yourself
    using the EnumFontFamilies or EnumFontFamiliesEx apis with the callback EnumFontFamExProc
    in a module. If you specify a name in the logfont structure/type, only that
    font will enumerate. The Platform SDK has a good explanation under EnumFontFamiliesEx
    of this.

    if you are trying to fit True Type text into a certain area, this gets very
    complicated because they can be fixed or variable. The font mapper (aka
    Mangler) CreateFontIndirect api will create the closest font to the size
    you need, but font typeface, width, and satisfaction is not guaranteed. See
    Windows Font Mapping by Ron Gery in the MSDN for a good start. VB Programmer's
    guide to the Win32 API is also a great help.

    In practice I was able to make an excellent gui for a legacy character based
    app, but true types and all their variants added about 2 months of writing
    and debugging. You will also want to get familiar with the ExtTextOut, GetCharacterPlacement,
    getCharABCWidthsFloat, and GetTextExtentPoint or their openGL counterparts.


    "Mike Turner" <mike012321@hotmaol.com> wrote:
    >How does one obtain the font sizes associated with a given font?
    >
    >eg of sort of thing required:
    >
    >In a word processing programme you might have one drop-down list box
    >containing the available fonts and another one that displays all the font
    >sizes for the currently selected font.)
    >
    >Would be grateful for any advice,coding etc on this.Thanks a lot.
    >
    >Mike Turner.
    >
    >
    >
    >
    >



  3. #3
    Peter Higgins Guest

    Re: Obtaining the font sizes associated with a particular font.


    Hi Mike;
    Welcome to the snake pit. You have a couple of options.

    One, use a system font dialog,

    two, if you need font information in the program logic, enumerate them yourself
    using the EnumFontFamilies or EnumFontFamiliesEx apis with the callback EnumFontFamExProc
    in a module. If you specify a name in the logfont structure/type, only that
    font will enumerate. The Platform SDK has a good explanation under EnumFontFamiliesEx
    of this.

    if you are trying to fit True Type text into a certain area, this gets very
    complicated because they can be fixed or variable. The font mapper (aka
    Mangler) CreateFontIndirect api will create the closest font to the size
    you need, but font typeface, width, and satisfaction is not guaranteed. See
    Windows Font Mapping by Ron Gery in the MSDN for a good start. VB Programmer's
    guide to the Win32 API is also a great help.

    In practice I was able to make an excellent gui for a legacy character based
    app, but true types and all their variants added about 2 months of writing
    and debugging. You will also want to get familiar with the ExtTextOut, GetCharacterPlacement,
    getCharABCWidthsFloat, and GetTextExtentPoint or their openGL counterparts.


    "Mike Turner" <mike012321@hotmaol.com> wrote:
    >How does one obtain the font sizes associated with a given font?
    >
    >eg of sort of thing required:
    >
    >In a word processing programme you might have one drop-down list box
    >containing the available fonts and another one that displays all the font
    >sizes for the currently selected font.)
    >
    >Would be grateful for any advice,coding etc on this.Thanks a lot.
    >
    >Mike Turner.
    >
    >
    >
    >
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center