; A debugger
Procedure DebugFontParameters(DeviceContext.l)
Color = GetTextColor_(DeviceContext)
Debug "Color is " + Str(Red(Color)) + " " + Str(Green(Color)) + " " + Str(Blue(Color))
FaceName.s = Space(255)
Debug GetTextFace_(DeviceContext, 255, @FaceName)
Debug FaceName
Debug GetLastError_()
GetTextMetrics_(DeviceContext, @TxtMetrics.TEXTMETRIC)
Debug "Height = " + Str(TxtMetrics\tmHeight) ; Specifies the height (ascent + descent) of characters.
Debug "Ascent = " + Str(TxtMetrics\tmAscent) ; Specifies the ascent (units above the base line) of characters.
Debug "Descent = " + Str(TxtMetrics\tmDescent) ; Specifies the descent (units below the base line) of characters.
Debug "Leading = " + Str(TxtMetrics\tmInternalLeading) ; Specifies the amount of leading (space) inside the bounds set by the tmHeight member. Accent marks And other diacritical characters may occur in this area. The designer may set this member To zero.
Debug "ExternalLeadin = " + Str(TxtMetrics\tmExternalLeading) ; Specifies the amount of extra leading (space) that the application adds between rows. Since this area is outside the font, it contains no marks And is not altered by text output calls in either OPAQUE Or TRANSPARENT mode. The designer may set this member To zero.
Debug "AveCharWidth = " + Str(TxtMetrics\tmAveCharWidth) ; Specifies the average width of characters in the font (generally defined as the width of the letter x). This value does not include the overhang required For bold Or italic characters.
Debug "MaxCharWidth = " + Str(TxtMetrics\tmMaxCharWidth) ; Specifies the width of the widest character in the font.
Debug "Weight = " + Str(TxtMetrics\tmWeight) ; Specifies the weight of the font.
Debug "Overhang = " + Str(TxtMetrics\tmOverhang) ; Specifies the extra width per string that may be added To some synthesized fonts. When synthesizing some attributes, such as bold Or italic, graphics device Interface (GDI) Or a device may have To add width To a string on both a per-character And per-string basis. For example, GDI makes a string bold by expanding the spacing of each character And overstriking by an offset value; it italicizes a font by shearing the string. In either case, there is an overhang past the basic string. For bold strings, the overhang is the distance by which the overstrike is offset. For italic strings, the overhang is the amount the top of the font is sheared past the bottom of the font.
; The tmOverhang member enables the application To determine how much of the character width returned by a GetTextExtentPoint32 function call on a single character is the actual character width And how much is the per-string extra width. The actual width is the extent minus the overhang.
Debug "DigitizedAspectX = " + Str(TxtMetrics\tmDigitizedAspectX) ; Specifies the horizontal aspect of the device For which the font was designed.
Debug "DigitizedAspectY = " + Str(TxtMetrics\tmDigitizedAspectY) ; Specifies the vertical aspect of the device For which the font was designed. The ratio of the tmDigitizedAspectX And tmDigitizedAspectY members is the aspect ratio of the device For which the font was designed.
Debug "FirstChar = " + Str(TxtMetrics\tmFirstChar) ; Specifies the value of the first character defined in the font.
Debug "LastChar = " + Str(TxtMetrics\tmLastChar) ; Specifies the value of the last character defined in the font.
Debug "DefaultChar = " + Str(TxtMetrics\tmDefaultChar) ; Specifies the value of the character To be substituted For characters not in the font.
Debug "BreakChar = " + Str(TxtMetrics\tmBreakChar) ; Specifies the value of the character that will be used To define word breaks For text justification.
Debug "Italic = " + Str(TxtMetrics\tmItalic) ; Specifies an italic font If it is nonzero.
Debug "Underlined = " + Str(TxtMetrics\tmUnderlined) ; Specifies an underlined font If it is nonzero.
Debug "StruckOut = " + Str(TxtMetrics\tmStruckOut) ; Specifies a strikeout font If it is nonzero.
Debug "PitchAndFamily = " + Str(TxtMetrics\tmPitchAndFamily) ; Specifies information about the pitch, the technology, And the family of a physical font.
; The four low-order bits of this member specify information about the pitch And the technology of the font. A constant is defined For each of the four bits:
; Constant Meaning
; TMPF_FIXED_PITCH If this bit is set the font is a variable pitch font. If this bit is clear the font is a fixed pitch font. Note very carefully that those meanings are the opposite of what the constant name implies.
; TMPF_VECTOR If this bit is set the font is a vector font.
; TMPF_TRUETYPE If this bit is set the font is a TrueType font.
; TMPF_DEVICE If this bit is set the font is a device font.
; An application should carefully test For qualities encoded in these low-order bits, making no arbitrary assumptions. For example, besides having their own bits set, TrueType And PostScript fonts set the TMPF_VECTOR bit. A monospace bitmap font has all of these low-order bits clear; a proportional bitmap font sets the TMPF_FIXED_PITCH bit. A Postscript printer device font sets the TMPF_DEVICE, TMPF_VECTOR, and TMPF_FIXED_PITCH bits.
; The four high-order bits of tmPitchAndFamily designate the font's font family. An application can use the value 0xF0 and the bitwise AND operator to mask out the four low-order bits of tmPitchAndFamily, thus obtaining a value that can be directly compared with font family names to find an identical match. For information about font families, see the description of the LOGFONT structure.
Debug "CharSet = " + Str(TxtMetrics\tmCharSet) ; Specifies the character set of the font.
Debug "====================="
EndProcedure
ok=OpenWindow(0,0,0,200,200,"ok")
ok2=EditorGadget(0,10,10,120,30)
hdc = GetDC_(ok)
DebugFontParameters(ok)
ReleaseDC_(ok, hdc)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
@Mesa , c'est toujours cool de citer l'auteur du code
voir de donner le lien
car là (brune nie) , on pourrai croire que c'est toi l'auteur , vu que tu ne cite personne
de plus , nous savons aussi nous servir du bouton de recherche
enfin, je pense que c'est un oubli de ta part
Dernière modification par Backup le sam. 11/févr./2012 0:09, modifié 1 fois.