Einzelnen Beitrag anzeigen

Muetze1
(Gast)

n/a Beiträge
 
#2

Re: Wie LogFont-Struktur füllen?

  Alt 17. Apr 2008, 17:05
Zitat von BlueStarHH:
Einge dieser Infos benötige ich. Wenn ich die LogFont-Struktur mit dem unteren Code fülle, sind lfHeight und lfWidth und auch andere Felder bei allen Fonts immer gleich, obwohl sie es nicht sein dürften.
Wie kommst du dazu, dass sie nicht gleich sein dürfen? Ich zitier mal kurz die MSDN dazu:

MSDN: lfHeight
lfHeight
Specifies the height, in logical units, of the font's character cell or character. The character height value (also known as the em height) is the character cell height value minus the internal-leading value. The font mapper interprets the value specified in lfHeight in the following manner.
Value Meaning
> 0 The font mapper transforms this value into device units and matches it against the cell height of the available fonts.
0 The font mapper uses a default height value when it searches for a match.
< 0 The font mapper transforms this value into device units and matches its absolute value against the character height of the available fonts.

For all height comparisons, the font mapper looks for the largest font that does not exceed the requested size.

This mapping occurs when the font is used for the first time.

For the MM_TEXT mapping mode, you can use the following formula to specify a height for a font with a specified point size:

lfHeight = -MulDiv(PointSize, GetDeviceCaps(hDC, LOGPIXELSY), 72);



MSDN: lfWidth
Specifies the average width, in logical units, of characters in the font. If lfWidth is zero, the aspect ratio of the device is matched against the digitization aspect ratio of the available fonts to find the closest match, determined by the absolute value of the difference.


Zitat von BlueStarHH:
Dieser Code gibt folgendes aus:

Delphi-Quellcode:
lfFaceName: Arial
lfHeight: -11 (richtig wäre 36)
lfWidth: 0 (richtig wäre 14)
lfFaceName: Comic Sans MS
lfHeight: -11 (richtig wäre 45)
lfWidth: 0 (richtig wäre 15)
Mit anderen Worten: Woher du deine Vergleichswerte auch immer hast, der Ersteller der Fonts bzw. Nutzer hat diese angepasst.

Zitat von BlueStarHH:
Ich brauche auch einige andere Werte aus der LogFont-Struktur, deswegen jetzt bitte nicht schreiben, dass man auch auf andere Wege die Höhe/Breite ermitteln kann.
Mit den Daten kommt man nicht so schnell auf die Höhe/Weite, somit haben die damit nicht allzu viel zu tun.
  Mit Zitat antworten Zitat