lcl: add an ability to select cleartype fonts on windows.

qt: add support for cleartype font requests

git-svn-id: trunk@20907 -
This commit is contained in:
paul 2009-07-20 14:19:09 +00:00
parent d981475609
commit e93e11b149
4 changed files with 21 additions and 10 deletions

View File

@ -59,7 +59,8 @@ type
TFontStyles = set of TFontStyle;
TFontStylesbase = set of TFontStyle;
TFontCharSet = 0..255;
TFontQuality = (fqDefault, fqDraft, fqProof, fqNonAntialiased, fqAntialiased);
TFontQuality = (fqDefault, fqDraft, fqProof, fqNonAntialiased, fqAntialiased,
fqCleartype, fqCleartypeNatural);
TFontData = record
Handle: HFont;

View File

@ -1060,7 +1060,8 @@ const
LF_BOOL: array[Boolean] of Byte = (0, 255);
LF_WEIGHT: array[Boolean] of Integer = (FW_NORMAL, FW_BOLD);
LF_QUALITY: array[TFontQuality] of Integer = (DEFAULT_QUALITY,
DRAFT_QUALITY, PROOF_QUALITY, NONANTIALIASED_QUALITY, ANTIALIASED_QUALITY);
DRAFT_QUALITY, PROOF_QUALITY, NONANTIALIASED_QUALITY, ANTIALIASED_QUALITY,
CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY);
var
ALogFont: TLogFont;
CachedFont: TFontHandleCacheDescriptor;

View File

@ -534,8 +534,15 @@ var
QtFont: TQtFont;
FamilyName: string;
const
QStyleStategy: Array [DEFAULT_QUALITY..ANTIALIASED_QUALITY] of QFontStyleStrategy =
(QFontPreferDefault, QFontPreferMatch, QFontPreferQuality, QFontNoAntialias, QFontPreferAntialias);
QStyleStategy: array [DEFAULT_QUALITY..CLEARTYPE_NATURAL_QUALITY] of QFontStyleStrategy = (
{ DEFAULT_QUALITY } QFontPreferDefault,
{ DRAFT_QUALITY } QFontPreferMatch,
{ PROOF_QUALITY } QFontPreferQuality,
{ NONANTIALIASED_QUALITY } QFontNoAntialias,
{ ANTIALIASED_QUALITY } QFontPreferAntialias,
{ CLEARTYPE_QUALITY } QFontPreferAntialias,
{ CLEARTYPE_NATURAL_QUALITY } QFontPreferAntialias
);
begin
{$ifdef VerboseQtWinAPI}
WriteLn('[WinAPI CreateFontIndirectEx] FontName: ' + LongFontName);
@ -579,7 +586,7 @@ begin
QtFont.setFamily(FamilyName);
end;
if (LogFont.lfQuality >= DEFAULT_QUALITY) and (LogFont.lfQuality <= ANTIALIASED_QUALITY) then
if (LogFont.lfQuality >= Low(QStyleStategy)) and (LogFont.lfQuality <= High(QStyleStategy)) then
QtFont.setStyleStrategy(QStyleStategy[LogFont.lfQuality]);
finally
Result := HFONT(QtFont);

View File

@ -1212,11 +1212,13 @@ const
CLIP_TT_ALWAYS = (2 shl 4);
CLIP_EMBEDDED = (8 shl 4);
DEFAULT_QUALITY = 0;
DRAFT_QUALITY = 1;
PROOF_QUALITY = 2;
NONANTIALIASED_QUALITY = 3;
ANTIALIASED_QUALITY = 4;
DEFAULT_QUALITY = 0;
DRAFT_QUALITY = 1;
PROOF_QUALITY = 2;
NONANTIALIASED_QUALITY = 3;
ANTIALIASED_QUALITY = 4;
CLEARTYPE_QUALITY = 5;
CLEARTYPE_NATURAL_QUALITY = 6;
DEFAULT_PITCH = 0;
FIXED_PITCH = 1;