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.
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.
>
>
>
>
>
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.
>
>
>
>
>