Re: How to get the exact size of a Character, Symbol?
From: Tom Ferguson (tomf_at_mvps.org)
Date: 05/27/04
- Next message: Alberto Brivio: "Installing new fonts"
- Previous message: PJ Usher: "Font substitutions"
- In reply to: chenfeng: "Re: How to get the exact size of a Character, Symbol?"
- Next in thread: mail_at_albumsfamily.com: "Re: How to get the exact size of a Character, Symbol?"
- Reply: mail_at_albumsfamily.com: "Re: How to get the exact size of a Character, Symbol?"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 27 May 2004 13:43:52 -0300
Excellent! I am glad you found a solution.
Tom
MSMVP-DTS
"chenfeng" <chenfeng@mailto.com.cn> wrote in message
news:ekxc3k7QEHA.2468@TK2MSFTNGP11.phx.gbl...
> Thanks very much for your help! And I am sorry for my poor english.
> The exact dimensions of any particular symbol are defined in the related
> font file. More ever, "Bold", "Italic", "Subscript" and "Superscript"
> have
> effect on the width of a character, which are also defined in the font
> file.
> I achieved to read the need width by using a class of Delphi, Which is
> called "TCanvas". The following is a example:
> var Canvas : TCanvas;
> notUsed : HWND;
> CharWidth : integer;
> Canvas := TCanvas.Create;
> Canvas.Handle := GetDeviceContext(notUsed);
> Canvas.Font.Name := 'Symbol';
> Canvas.Font.Size := 12;//points
> CharWidth := Canvas.TextWidth(#50);
> Canvas.Font.Style := [fsBold];
> CharWidth := Canvas.TextWidth(#50);
>
>
> "peter" <ps@cogeco.ca> wrote in message
> news:240520041657421840%ps@cogeco.ca...
>> [[ This message was both posted and mailed: see
>> the "To," "Cc," and "Newsgroups" headers for details. ]]
>>
>> In article <uTBxmfbQEHA.3124@TK2MSFTNGP12.phx.gbl>, Tom Ferguson
>> <tomf@mvps.org> wrote:
>>
>> > "How to get the width of a symbol ? "
>> >
>> If you go to the afm tables that come with PS fonts, the widths are
>> there. I don't use TT fonts so I can't tell you anything about them.
>> Or you could open the font in Fontographer or Fontlab and get the
>> widths there.
>>
>>
>>
>> > I don't know the answer to the question you ask because, in part, I
> don't
>> > know exactly what measurement you want when you refer to "font size"
> above
>> > or "width of a symbol".
>> >
>> > Please allow me to outline some basic concepts. I hope to at least
> answer
>> > some aspect of your question. I am doing this rather informally.
>> > Typographers would be horrified, I am sure.
>> >
>> > Each character, in data abstraction, is referred to as a glyph. This
>> > relationship, character as to glyph is similar to the relationship as
>> > between number as to numeral. Each glyph is imagined to be positioned
> inside
>> > a box, a "bounding" box, to be precise. All glyphs in a font are
> considered
>> > to be inside such a box of the same size. This idea goes back to the
> days of
>> > movable metal type. Then, the "bounding box" had a visible reality. It
> was
>> > the size of the rectangular, working end of the metal used to impress
> the
>> > paper.
>> >
>> > Each glyph is positioned inside this box. Because of differences in
> shape,
>> > not all characters hit the sides of the box. Indeed, in some instances,
>> > parts of glyphs might extend beyond in digital type. For the most part,
> all
>> > glyphs are conceived-of to be the same size as seen by the eye, all
> upper
>> > case the same size and all lower case the same size. To achieve this
> ideal,
>> > characters are actually different sizes within the box.
>> >
>> > So, it is not trivial to determine the exact dimensions of any
> particular
>> > glyph. The data to do so is in the font file but it is not available
>> > explicitly. In principal, code could be written to do it.
>> >
>> > To print text, the rasteriser (whether the Windows rasteriser alone or
> with
>> > involvement of Adobe Type Manager or files therefrom [Windows XP]) uses
> the
>> > TrueType file to get applicable data to print; however, leaving aside
>> > whether it calculates character dimensions, it does not output any
>> > dimensions that are externally accessible. So, you can't get the
> dimensions
>> > even by running a trial page image. A programmer might be able to write
> code
>> > to hook into the system to do this but that is by no means trivial
> either.
>> >
>> > To complicate matters further, there is hinting and kerning. Both
> influence
>> > the spacing between characters as printed. Hinting, less so since the
>> > difference is typically a pixel or two (to refer to measurements on a
>> > screen). Kerning shifts the printing position and can cause bounding
> boxes
>> > to overlap. Indeed, in Word, you can alter the printing position on a
>> > character-by-character basis over quite a wide range.
>> >
>> > Hope this is useful.
>> >
>> > I have done some reading on the topic but am far from being an expert.
>> > Anyone offering corrections or additions would be welcome.
>> >
>> >
>> > Tom Ferguson
>> > MSMVP-DTS
>> >
>> A good explanation Tom.
>> As a bit of background info - in metal type some characters hung
>> outside the body of the type, especially in some italic and script
>> typefaces.
>> These overhanging parts are called the kern of the character; that's
>> where the terminology of kerning comes from. If you can imagine an
>> italic f - I'm not going to attempt an ascii version of this. The
>> bottom of the f (which is slanted) hung over the left-hand side of the
>> body, and the top of the f hung over the right-hand side of the body.
>> So if the f was followed by another f, or an i, or an l, then those two
>> characters would be replaced by the appropriate ligature. Or else the
>> compositor (or Monotype keyboard operator) would use shoulder-high word
>> spaces to support the overhanging kern of these characters.
>> Unfortunately, digital type (and before that photo type) can be
>> manipulated at will (both horizontally and vertically, and in some
>> software even slanting). Actually, manipulated is the wrong word -
>> distorted would be better.
>>
>> But this is getting away from the original question.
>>
>> Peter
>
>
- Next message: Alberto Brivio: "Installing new fonts"
- Previous message: PJ Usher: "Font substitutions"
- In reply to: chenfeng: "Re: How to get the exact size of a Character, Symbol?"
- Next in thread: mail_at_albumsfamily.com: "Re: How to get the exact size of a Character, Symbol?"
- Reply: mail_at_albumsfamily.com: "Re: How to get the exact size of a Character, Symbol?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|