LCL: Remove deprecated function FontCanUTF8. All widgetsets returned True, including GTK(2) and QT(5). Not implementing it caused bugs.

git-svn-id: trunk@62425 -
This commit is contained in:
juha 2019-12-20 17:45:44 +00:00
parent 0fa939d56e
commit b46b72fb2b
28 changed files with 11 additions and 163 deletions

View File

@ -8407,8 +8407,7 @@ begin
Style := []; // Reserved for Highlighter
end;
//debugln(['TCustomSynEdit.RecalcCharExtent ',fFontDummy.Name,' ',fFontDummy.Size]);
//debugln('TCustomSynEdit.RecalcCharExtent A UseUTF8=',dbgs(UseUTF8),
// ' Font.CanUTF8='+dbgs(Font.CanUTF8)+' CharHeight=',dbgs(CharHeight));
//debugln('TCustomSynEdit.RecalcCharExtent A UseUTF8=',dbgs(UseUTF8),' CharHeight=',dbgs(CharHeight));
fTextDrawer.BaseFont := FFontDummy;
if Assigned(fHighlighter) then
@ -8435,7 +8434,7 @@ begin
finally
DecStatusChangeLock;
end;
//debugln('TCustomSynEdit.RecalcCharExtent UseUTF8=',dbgs(UseUTF8),' Font.CanUTF8=',dbgs(Font.CanUTF8));
//debugln('TCustomSynEdit.RecalcCharExtent UseUTF8=',dbgs(UseUTF8));
end;
procedure TCustomSynEdit.HighlighterAttrChanged(Sender: TObject);

View File

@ -964,8 +964,8 @@ end;
function TheTextDrawer.GetUseUTF8: boolean;
begin
FFontStock.BaseFont.Reference;
Result:=FFontStock.BaseFont.CanUTF8;
//debugln('TheTextDrawer.GetUseUTF8 ',FFontStock.BaseFont.Name,' ',dbgs(FFontStock.BaseFont.CanUTF8),' ',dbgs(FFontStock.BaseFont.HandleAllocated));
Result:=True;
//debugln('TheTextDrawer.GetUseUTF8 ',FFontStock.BaseFont.Name,' ',dbgs(FFontStock.BaseFont.HandleAllocated));
end;
function TheTextDrawer.GetMonoSpace: boolean;

View File

@ -480,8 +480,6 @@ type
TFont = class(TFPCustomFont)
private
FCanUTF8: boolean;
FCanUTF8Valid: boolean;
FIsMonoSpace: boolean;
FIsMonoSpaceValid: boolean;
FOrientation: Integer;
@ -497,7 +495,6 @@ type
FHeight: integer; // FHeight = -(FSize * FPixelsPerInch) div 72
FReference: TWSFontReference;
procedure FreeReference;
function GetCanUTF8: boolean;
function GetHandle: HFONT;
function GetData: TFontData;
function GetIsMonoSpace: boolean;
@ -547,7 +544,6 @@ type
function IsEqual(AFont: TFont): boolean; virtual;
property IsMonoSpace: boolean read GetIsMonoSpace;
procedure SetDefault;
property CanUTF8: boolean read GetCanUTF8; deprecated;
property PixelsPerInch: Integer read FPixelsPerInch write SetPixelsPerInch;
property Reference: TWSFontReference read GetReference;
published

View File

@ -1169,7 +1169,6 @@ begin
finally
FontResourceCache.Unlock;
end;
FCanUTF8Valid := False;
FIsMonoSpaceValid := False;
end;
@ -1230,16 +1229,6 @@ begin
FReference._lclHandle := 0;
end;
function TFont.GetCanUTF8: boolean;
begin
if not FCanUTF8Valid then
begin
FCanUTF8 := {%H-}FontCanUTF8(HFONT(Reference.Handle));
FCanUTF8Valid := True;
end;
Result := FCanUTF8;
end;
function TFont.GetCharSet: TFontCharSet;
begin
Result := FCharSet;

View File

@ -333,12 +333,6 @@ begin
Result:=TextOut(DC,X,Y,Str,Count);
end;
function TWidgetSet.FontCanUTF8(Font: HFont): boolean;
begin
Result:=false;
end;
function TWidgetSet.FontIsMonoSpace(Font: HFont): boolean;
begin
Result:=false;

View File

@ -188,11 +188,6 @@ begin
Result := WidgetSet.TextUTF8Out(DC,X,Y,Str,Count);
end;
function FontCanUTF8(Font: HFont): boolean;
begin
Result := WidgetSet.FontCanUTF8(Font){%H-};
end;
function FontIsMonoSpace(Font: HFont): boolean;
begin
Result := WidgetSet.FontIsMonoSpace(Font);

View File

@ -62,8 +62,6 @@ procedure DrawDefaultDockImage(AOldRect, ANewRect: TRect; AOperation: TDockImage
procedure DrawGrid(DC: HDC; const R: TRect; DX, DY: Integer); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function ExtUTF8Out(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function FontCanUTF8(Font: HFont): boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} deprecated;
function FontIsMonoSpace(Font: HFont): boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function Frame3d(DC: HDC; var ARect: TRect; const FrameWidth : integer; const Style : TGraphicsBevelCut): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}

View File

@ -7260,8 +7260,7 @@ begin
//debugln('TWinControl.CNChar B ',DbgSName(Self),' ',dbgs(Message.CharCode),' ',dbgs(IntfSendsUTF8KeyPress));
if Widgetset.GetLCLCapability(lcSendsUTF8KeyPress) = LCL_CAPABILITY_NO then
begin
// current interface does not (yet) send UTF8 key press notifications
// -> emulate
// current interface does not (yet) send UTF8 key press notifications -> emulate
if (Message.CharCode < %11000000) then
begin
c:=chr(Message.CharCode);

View File

@ -69,11 +69,6 @@ begin
TCarbonDeviceContext(DC).DrawGrid(R, DX, DY);
end;
function TCarbonWidgetSet.FontCanUTF8(Font: HFont): boolean;
begin
Result := True;
end;
function TCarbonWidgetSet.GetAcceleratorString(const AVKey: Byte;
const AShiftState: TShiftState): String;
begin

View File

@ -24,8 +24,6 @@
function CreateStandardCursor(ACursor: SmallInt): hCursor; override;
procedure DrawGrid(DC: HDC; const R: TRect; DX, DY: Integer); override;
function FontCanUTF8({%H-}Font: HFont): boolean; override;
function GetAcceleratorString(const AVKey: Byte; const AShiftState: TShiftState): String; override;
function GetControlConstraints(Constraints: TObject): boolean; override;
function GetDesignerDC(WindowHandle: HWND): HDC; override;

View File

@ -62,12 +62,6 @@ begin
end;
end;
function TCocoaWidgetSet.FontCanUTF8(Font: HFont): boolean;
begin
// no so deprecated, after all. SynEdit is still using it and caused the issue #34594
Result:=true;
end;
(*
{------------------------------------------------------------------------------
Method: DrawGrid
@ -94,11 +88,6 @@ begin
Result:=inherited ExtUTF8Out(DC, X, Y, Options, Rect, Str, Count, Dx);
end;
function TCarbonWidgetSet.FontCanUTF8(Font: HFont): boolean;
begin
Result := True;
end;
function TCarbonWidgetSet.GetAcceleratorString(const AVKey: Byte;
const AShiftState: TShiftState): String;
begin

View File

@ -24,9 +24,7 @@ function CreateStandardCursor(ACursor: SmallInt): hCursor; override;
function ExtUTF8Out(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect;
Str: PChar; Count: Longint; Dx: PInteger): Boolean; override;
}
function FontCanUTF8(Font: HFont): boolean; override;
{
function GetAcceleratorString(const AVKey: Byte; const AShiftState: TShiftState): String; override;
function GetControlConstraints(Constraints: TObject): boolean; override;
function GetDesignerDC(WindowHandle: HWND): HDC; override;

View File

@ -202,16 +202,6 @@ begin
QWidget_destroy(QRubberBandH(ARubberBand));
end;
{------------------------------------------------------------------------------
Function: FontCanUTF8
Params:
Returns:
------------------------------------------------------------------------------}
function TQtWidgetSet.FontCanUTF8(Font: HFont): Boolean;
begin
Result := IsValidGDIObject(Font);
end;
{------------------------------------------------------------------------------
Function: FontIsMonoSpace
Params:

View File

@ -34,11 +34,9 @@ function CreateEmptyRegion: hRGN; override;
function CreateRubberBand(const ARect: TRect; const ABrush: HBrush = 0): HWND; override;
procedure DrawDefaultDockImage(AOldRect, ANewRect: TRect; AOperation: TDockImageOperation); override;
procedure DrawGrid(DC: HDC; const R: TRect; DX, DY: Integer); override;
procedure DestroyRubberBand(ARubberBand: HWND); override;*)
(*function FontCanUTF8(Font: HFont): boolean; override; // Dont implement, deprecated
function FontIsMonoSpace(Font: HFont): boolean; override;*)
procedure DestroyRubberBand(ARubberBand: HWND); override;
function FontIsMonoSpace(Font: HFont): boolean; override;
*)
function GetAvailableNativeCanvasTypes(DC: HDC; AAllowFallbackToParent: Boolean = False): TNativeCanvasTypes; override;
function GetAvailableNativeHandleTypes(Handle: HWND; AAllowFallbackToParent: Boolean = False): TNativeHandleTypes; override;
//function GetDesignerDC(WindowHandle: HWND): HDC; override;

View File

@ -43,18 +43,6 @@ const
);
{------------------------------------------------------------------------------
function FontCanUTF8(Font: HFont): boolean;
True if font recognizes Unicode UTF8 encoding.
FPGUI supports only Unicode
------------------------------------------------------------------------------}
function TFpGuiWidgetSet.FontCanUTF8(Font: HFont): boolean;
begin
Result := True;
end;
function TFpGuiWidgetSet.PromptUser(const DialogCaption, DialogMessage: String;
DialogType: longint; Buttons: PLongint; ButtonCount, DefaultIndex,
EscapeResult: Longint): Longint;

View File

@ -35,11 +35,9 @@ procedure DeallocateHWnd(Wnd: HWND); override;
procedure DrawDefaultDockImage(AOldRect, ANewRect: TRect; AOperation: TDockImageOperation); override;
function ExtUTF8Out(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect;
Str: PChar; Count: Longint; Dx: PInteger): Boolean; override;}
Str: PChar; Count: Longint; Dx: PInteger): Boolean; override;
function FontCanUTF8(Font: HFont): boolean; override;
{function GetAcceleratorString(const AVKey: Byte; const AShiftState: TShiftState): String; override;
function GetAcceleratorString(const AVKey: Byte; const AShiftState: TShiftState): String; override;
function GetControlConstraints(Constraints: TObject): boolean; override;
}
function PromptUser(const DialogCaption, DialogMessage: String; DialogType: longint;

View File

@ -170,20 +170,6 @@ begin
end;
end;
{------------------------------------------------------------------------------
function TGTKWidgetSet.FontCanUTF8(Font: HFont): boolean;
True if font recognizes Unicode UTF8 encoding.
------------------------------------------------------------------------------}
function TGTKWidgetSet.FontCanUTF8(Font: HFont): boolean;
begin
Result:=IsValidGDIObject(Font)
{$IFDEF Gtk1}
and FontIsDoubleByteCharsFont(PGdiObject(Font)^.GDIFontObject)
{$ENDIF}
;
end;
{------------------------------------------------------------------------------
function TGTKWidgetSet.FontIsMonoSpace(Font: HFont): boolean;

View File

@ -36,8 +36,6 @@ procedure DrawGrid(DC: HDC; const R: TRect; DX, DY: Integer); override;
function ExtUTF8Out(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect;
Str: PChar; Count: Longint; Dx: PInteger): Boolean; override;
function FontCanUTF8(Font: HFont): boolean; override;
function FontIsMonoSpace(Font: HFont): boolean; override;
function GetAcceleratorString(const AVKey: Byte; const AShiftState: TShiftState): String; override;

View File

@ -189,16 +189,6 @@ begin
Result := TextOut(DC, X, Y, Str, Count);
end;
{------------------------------------------------------------------------------
function TGtk2WidgetSet.FontCanUTF8(Font: HFont): boolean;
True if font recognizes Unicode UTF8 encoding.
------------------------------------------------------------------------------}
function TGtk2WidgetSet.FontCanUTF8(Font: HFont): boolean;
begin
Result:=IsValidGDIObject(Font);
end;
{------------------------------------------------------------------------------
function TGtk2WidgetSet.FontIsMonoSpace(Font: HFont): boolean;

View File

@ -40,8 +40,6 @@ procedure DrawGrid(DC: HDC; const R: TRect; DX, DY: Integer); override;
function ExtUTF8Out(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect;
Str: PChar; Count: Longint; Dx: PInteger): Boolean; override;
function FontCanUTF8(Font: HFont): boolean; override;
function FontIsMonoSpace(Font: HFont): boolean; override;
function GetAcceleratorString(const AVKey: Byte; const AShiftState: TShiftState): String; override;

View File

@ -155,16 +155,6 @@ begin
Result := TextOut(DC, X, Y, Str, Count);
end;
{------------------------------------------------------------------------------
function TGtk3WidgetSet.FontCanUTF8(Font: HFont): boolean;
True if font recognizes Unicode UTF8 encoding.
------------------------------------------------------------------------------}
function TGtk3WidgetSet.FontCanUTF8(Font: HFont): boolean;
begin
Result := True; // IsValidGDIObject(Font);
end;
{------------------------------------------------------------------------------
function TGtk3WidgetSet.FontIsMonoSpace(Font: HFont): boolean;

View File

@ -35,8 +35,6 @@ procedure DrawGrid(DC: HDC; const R: TRect; DX, DY: Integer); override;
function ExtUTF8Out(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect;
Str: PChar; Count: Longint; Dx: PInteger): Boolean; override;
function FontCanUTF8(Font: HFont): boolean; override;
function FontIsMonoSpace(Font: HFont): boolean; override;
function GetAcceleratorString(const AVKey: Byte; const AShiftState: TShiftState): String; override;

View File

@ -313,16 +313,6 @@ begin
QWidget_destroy(QRubberBandH(ARubberBand));
end;
{------------------------------------------------------------------------------
Function: FontCanUTF8
Params:
Returns:
------------------------------------------------------------------------------}
function TQtWidgetSet.FontCanUTF8(Font: HFont): boolean;
begin
Result := IsValidGDIObject(Font);
end;
{------------------------------------------------------------------------------
Function: FontIsMonoSpace
Params:

View File

@ -44,7 +44,6 @@ procedure DrawGrid(DC: HDC; const R: TRect; DX, DY: Integer); override;
procedure DestroyRubberBand(ARubberBand: HWND); override;
function ExtUTF8Out(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean; override;
function FontCanUTF8(Font: HFont): boolean; override;
function FontIsMonoSpace(Font: HFont): boolean; override;
function GetDesignerDC(WindowHandle: HWND): HDC; override;

View File

@ -311,16 +311,6 @@ begin
QWidget_destroy(QRubberBandH(ARubberBand));
end;
{------------------------------------------------------------------------------
Function: FontCanUTF8
Params:
Returns:
------------------------------------------------------------------------------}
function TQtWidgetSet.FontCanUTF8(Font: HFont): boolean;
begin
Result := IsValidGDIObject(Font);
end;
{------------------------------------------------------------------------------
Function: FontIsMonoSpace
Params:

View File

@ -44,12 +44,9 @@ procedure DrawGrid(DC: HDC; const R: TRect; DX, DY: Integer); override;
procedure DestroyRubberBand(ARubberBand: HWND); override;
function ExtUTF8Out(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean; override;
function FontCanUTF8(Font: HFont): boolean; override;
function FontIsMonoSpace(Font: HFont): boolean; override;
function GetDesignerDC(WindowHandle: HWND): HDC; override;
function IsDesignerDC(WindowHandle: HWND; DC: HDC): Boolean; override;
function PromptUser(const DialogCaption : string;

View File

@ -93,16 +93,6 @@ begin
Result := ExtTextOut(DC, X, Y, Options, Rect, Str, Count, Dx);
end;
{------------------------------------------------------------------------------
function FontCanUTF8(Font: HFont): boolean;
True if font recognizes Unicode UTF8 encoding.
------------------------------------------------------------------------------}
function TWin32WidgetSet.FontCanUTF8(Font: HFont): boolean;
begin
Result := True;
end;
type
TFontIsMonoSpaceRec = record
Name: string;

View File

@ -42,8 +42,6 @@ procedure DrawGrid(DC: HDC; const R: TRect; DX, DY: Integer); override;
function ExtUTF8Out(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect;
Str: PChar; Count: Longint; Dx: PInteger): Boolean; override;
function FontCanUTF8({%H-}Font: HFont): boolean; override;
function FontIsMonoSpace(Font: HFont): boolean; override;
function GetAcceleratorString(const AVKey: Byte; const AShiftState: TShiftState): String; override;