added FontIsMonoSpace

git-svn-id: trunk@10043 -
This commit is contained in:
mattias 2006-10-05 21:50:05 +00:00
parent ad37c9edfd
commit 9747f91093
22 changed files with 357 additions and 248 deletions

View File

@ -220,6 +220,7 @@ type
procedure DoSetCharExtra(Value: Integer); virtual;
{$IFDEF SYN_LAZARUS}
function GetUseUTF8: boolean;
function GetMonoSpace: boolean;
{$ENDIF}
property StockDC: HDC read FDC;
property DrawingCount: Integer read FDrawingCount;
@ -253,6 +254,7 @@ type
property CharExtra: Integer read FCharExtra write SetCharExtra;
{$IFDEF SYN_LAZARUS}
property UseUTF8: boolean read GetUseUTF8;
property MonoSpace: boolean read GetMonoSpace;
{$ENDIF}
end;
@ -951,6 +953,13 @@ begin
Result:=FFontStock.BaseFont.CanUTF8;
//debugln('TheTextDrawer.GetUseUTF8 ',FFontStock.BaseFont.Name,' ',dbgs(FFontStock.BaseFont.CanUTF8),' ',dbgs(FFontStock.BaseFont.HandleAllocated));
end;
function TheTextDrawer.GetMonoSpace: boolean;
begin
FFontStock.BaseFont.Handle;
Result:=FFontStock.BaseFont.IsMonoSpace;
//debugln('TheTextDrawer.GetMonoSpace ',FFontStock.BaseFont.Name,' ',dbgs(FFontStock.BaseFont.IsMonoSpace),' ',dbgs(FFontStock.BaseFont.HandleAllocated));
end;
{$ENDIF}
procedure TheTextDrawer.ReleaseETODist;
@ -1146,14 +1155,24 @@ procedure TheTextDrawer.ExtTextOut(X, Y: Integer; fuOptions: UINT;
FETOSizeInChar := TmpLen;
end;
var
NeedDistArray: Boolean;
DistArray: PInteger;
begin
{$IFDEF SYN_LAZARUS}
NeedDistArray:=not MonoSpace;
//DebugLn(['TheTextDrawer.ExtTextOut NeedDistArray=',NeedDistArray]);
if NeedDistArray then begin
if (FETOSizeInChar < Length) then
InitETODist(GetCharWidth);
DistArray:=PInteger(FETODist);
end else begin
DistArray:=nil;
end;
LCLIntf.ExtUTF8Out(FDC, X, Y, fuOptions, @ARect, Text, Length, DistArray);
{$ELSE}
if FETOSizeInChar < Length then
InitETODist(GetCharWidth);
{$IFDEF SYN_LAZARUS}
// TODO: disable distance Array (FETODist), when using monospace fonts
LCLIntf.ExtUTF8Out(FDC, X, Y, fuOptions, @ARect, Text,
Length, {$ifdef USE_UTF8BIDI_LCL}nil{$else}PInteger(FETODist){$endif});
{$ELSE}
Windows.ExtTextOut(FDC, X, Y, fuOptions, @ARect, Text,
Length, PInteger(FETODist));
{$ENDIF}

View File

@ -1,43 +1,19 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<Version Value="3"/>
<PathDelim Value="/"/>
<Version Value="5"/>
<General>
<ProjectType Value="Application"/>
<Flags>
<SaveClosedFiles Value="False"/>
<SaveOnlyProjectUnits Value="True"/>
</Flags>
<MainUnit Value="0"/>
<ActiveEditorIndexAtStart Value="0"/>
<IconPath Value="./"/>
<TargetFileExt Value=""/>
<Title Value="addrbook"/>
<ActiveEditorIndexAtStart Value="0"/>
</General>
<Units Count="2">
<Unit0>
<CursorPos X="20" Y="21"/>
<EditorIndex Value="1"/>
<Filename Value="addrbook.lpr"/>
<IsPartOfProject Value="True"/>
<Loaded Value="True"/>
<TopLine Value="1"/>
<UnitName Value="addrbook"/>
<UsageCount Value="32"/>
</Unit0>
<Unit1>
<CursorPos X="20" Y="22"/>
<EditorIndex Value="0"/>
<Filename Value="frmmain.pas"/>
<ComponentName Value="MainForm"/>
<IsPartOfProject Value="True"/>
<Loaded Value="True"/>
<ResourceFilename Value="frmmain.lrs"/>
<TopLine Value="1"/>
<UnitName Value="frmmain"/>
<UsageCount Value="32"/>
</Unit1>
</Units>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
@ -56,9 +32,31 @@
<MinVersion Major="1" Valid="True"/>
</Item1>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="addrbook.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="addrbook"/>
<CursorPos X="1" Y="30"/>
<TopLine Value="1"/>
<UsageCount Value="32"/>
</Unit0>
<Unit1>
<Filename Value="frmmain.pas"/>
<ComponentName Value="MainForm"/>
<IsPartOfProject Value="True"/>
<ResourceFilename Value="frmmain.lrs"/>
<UnitName Value="frmmain"/>
<CursorPos X="14" Y="33"/>
<TopLine Value="1"/>
<EditorIndex Value="0"/>
<UsageCount Value="32"/>
<Loaded Value="True"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="2"/>
<Version Value="5"/>
<SearchPaths>
<SrcPath Value="$(LazarusDir)/lcl/;$(LazarusDir)/lcl/interfaces/$(LCLWidgetType)/"/>
</SearchPaths>

View File

@ -19,13 +19,11 @@
***************************************************************************
}
program addrbook;
{$librarypath /opt/gnome/lib}
{$mode objfpc}{$H+}
uses
Interfaces,
frmmain,
Forms;
Interfaces, frmmain, Forms;
begin
Application.Initialize;

View File

@ -3151,6 +3151,7 @@ resourcestring
lisPListType = 'Type';
lisPListAll = '<All>';
lisPListNone = '<None>';
lisUIClearIncludedByReference = 'Clear included by reference';
implementation
end.

View File

@ -2996,10 +2996,6 @@ Begin
SearchResultsView.ShowOnTop;
End;
{------------------------------------------------------------------------------}
Procedure TMainIDE.mnuNewProjectClicked(Sender: TObject);
var
NewProjectDesc: TProjectDescriptor;
@ -4762,7 +4758,10 @@ var
LFMBuf: TCodeBuffer;
begin
Result:=CloseUnitComponent(AnUnitInfo,CloseFlags);
if Result<>mrOk then exit;
if Result<>mrOk then begin
DebugLn(['TMainIDE.DoLoadLFM failed due to CloseUnitComponent for file ',AnUnitInfo.Filename]);
exit;
end;
// Note: think about virtual and normal .lfm files.
LFMFilename:=ChangeFileExt(AnUnitInfo.Filename,'.lfm');
@ -4778,7 +4777,8 @@ begin
Result:=LoadIDECodeBuffer(LFMBuf,LFMFilename,[lbfUpdateFromDisk]);
if Result<>mrOk then exit;
Result:=DoLoadLFM(AnUnitInfo,LFMBuf,OpenFlags,CloseFlags);
Result:=DoLoadLFM(AnUnitInfo,LFMBuf,OpenFlags,
CloseFlags-[cfSaveFirst,cfSaveDependencies]);
end;
function TMainIDE.DoLoadLFM(AnUnitInfo: TUnitInfo; LFMBuf: TCodeBuffer;
@ -4787,7 +4787,6 @@ function TMainIDE.DoLoadLFM(AnUnitInfo: TUnitInfo; LFMBuf: TCodeBuffer;
const
BufSize = 4096; // allocating mem in 4k chunks helps many mem managers
var
ComponentLoadingOk: boolean;
TxtLFMStream, BinStream, AncestorBinStream: TExtMemoryStream;
NewComponent: TComponent;
AncestorType: TComponentClass;
@ -4801,17 +4800,17 @@ var
begin
debugln('TMainIDE.DoLoadLFM A ',AnUnitInfo.Filename,' IsPartOfProject=',dbgs(AnUnitInfo.IsPartOfProject),' ');
// close old designer form
Result:=CloseUnitComponent(AnUnitInfo,CloseFlags);
if Result<>mrOk then exit;
// check installed packages
if AnUnitInfo.IsPartOfProject then begin
if (AnUnitInfo.Component=nil) and AnUnitInfo.IsPartOfProject then begin
// opening a single form of the project -> check installed packages
Result:=PkgBoss.CheckProjectHasInstalledPackages(Project1);
if not (Result in [mrOk,mrIgnore]) then exit;
end;
// close old designer form
Result:=CloseUnitComponent(AnUnitInfo,CloseFlags);
if Result<>mrOk then exit;
//debugln('TMainIDE.DoLoadLFM LFM file loaded, parsing "',LFMBuf.Filename,'" ...');
if not AnUnitInfo.HasResources then begin
@ -4821,98 +4820,97 @@ begin
//debugln('TMainIDE.DoLoadLFM LFM="',LFMBuf.Source,'"');
ComponentLoadingOk:=true;
// find the classname of the LFM, and check for inherited form
ReadLFMHeader(LFMBuf.Source,NewClassName,LFMType);
if (NewClassName='') or (LFMType='') then begin
Result:=MessageDlg(lisLFMFileCorrupt,
Format(lisUnableToFindAValidClassnameIn, ['"', LFMBuf.Filename, '"']),
mtError,[mbIgnore,mbCancel,mbAbort],0);
exit;
end;
BinStream:=nil;
AncestorBinStream:=nil;
try
// find the ancestor type in the source
AncestorClassName:='';
AncestorType:=nil;
AncestorUnitInfo:=nil;
if not CodeToolBoss.FindFormAncestor(AnUnitInfo.Source,NewClassName,
AncestorClassName,true)
then begin
DebugLn('TMainIDE.DoLoadLFM Filename="',AnUnitInfo.Filename,'" NewClassName=',NewClassName,'. Unable to find ancestor class: ',CodeToolBoss.ErrorMessage);
end;
if AncestorClassName<>'' then begin
if CompareText(AncestorClassName,'TForm')=0 then begin
AncestorType:=TForm;
end else if CompareText(AncestorClassName,'TDataModule')=0 then begin
// use our TDataModule
// (some fpc versions have non designable TDataModule)
AncestorType:=TDataModule;
end else if CompareText(AncestorClassName,'TCustomForm')=0 then begin
MessageDlg('Error','The resource class "'+NewClassName+'" descends from'
+' "'+AncestorClassName+'". Probably this is a typo for TForm.',
mtError,[mbCancel],0);
Result:=mrCancel;
end;
end else begin
AncestorType:=TForm;
if AnUnitInfo.Component=nil then begin
// load/create new instance
// find the classname of the LFM, and check for inherited form
ReadLFMHeader(LFMBuf.Source,NewClassName,LFMType);
if (NewClassName='') or (LFMType='') then begin
Result:=MessageDlg(lisLFMFileCorrupt,
Format(lisUnableToFindAValidClassnameIn, ['"', LFMBuf.Filename, '"']),
mtError,[mbIgnore,mbCancel,mbAbort],0);
exit;
end;
// try loading the ancestor first (unit, lfm and component instance)
if (AncestorType=nil) then begin
Result:=DoLoadComponentDependencyHidden(AnUnitInfo,AncestorClassName,OpenFlags,
AncestorType,AncestorUnitInfo);
if Result=mrAbort then exit;
if Result=mrOk then begin
Result:=DoSaveFileResourceToBinStream(AncestorUnitInfo,AncestorBinStream);
if Result<>mrOk then exit;
AncestorBinStream.Position:=0;
end else begin
// the ancestor class was not found -> use TForm as default
AncestorType:=TForm;
AncestorUnitInfo:=nil;
end;
end;
// use TForm as default ancestor
if AncestorType=nil then
AncestorType:=TForm;
//DebugLn('TMainIDE.DoLoadLFM Filename="',AnUnitInfo.Filename,'" AncestorClassName=',AncestorClassName,' AncestorType=',AncestorType.ClassName);
BinStream:=TExtMemoryStream.Create;
TxtLFMStream:=TExtMemoryStream.Create;
BinStream:=nil;
AncestorBinStream:=nil;
try
LFMBuf.SaveToStream(TxtLFMStream);
AnUnitInfo.ComponentLastLFMStreamSize:=TxtLFMStream.Size;
TxtLFMStream.Position:=0;
// find the ancestor type in the source
AncestorClassName:='';
AncestorType:=nil;
AncestorUnitInfo:=nil;
if not CodeToolBoss.FindFormAncestor(AnUnitInfo.Source,NewClassName,
AncestorClassName,true)
then begin
DebugLn('TMainIDE.DoLoadLFM Filename="',AnUnitInfo.Filename,'" NewClassName=',NewClassName,'. Unable to find ancestor class: ',CodeToolBoss.ErrorMessage);
end;
if AncestorClassName<>'' then begin
if CompareText(AncestorClassName,'TForm')=0 then begin
AncestorType:=TForm;
end else if CompareText(AncestorClassName,'TDataModule')=0 then begin
// use our TDataModule
// (some fpc versions have non designable TDataModule)
AncestorType:=TDataModule;
end else if CompareText(AncestorClassName,'TCustomForm')=0 then begin
MessageDlg('Error','The resource class "'+NewClassName+'" descends from'
+' "'+AncestorClassName+'". Probably this is a typo for TForm.',
mtError,[mbCancel],0);
Result:=mrCancel;
end;
end else begin
AncestorType:=TForm;
end;
// convert text to binary format
try
if AnUnitInfo.ComponentLastBinStreamSize>0 then
BinStream.Capacity:=AnUnitInfo.ComponentLastBinStreamSize+BufSize;
LRSObjectTextToBinary(TxtLFMStream,BinStream);
AnUnitInfo.ComponentLastBinStreamSize:=BinStream.Size;
BinStream.Position:=0;
Result:=mrOk;
except
on E: Exception do begin
DumpExceptionBackTrace;
ACaption:=lisFormatError;
AText:=Format(lisUnableToConvertTextFormDataOfFileIntoBinaryStream,
[#13, '"', LFMBuf.Filename, '"', #13, E.Message]);
Result:=MessageDlg(ACaption, AText, mtError, [mbOk, mbCancel], 0);
if Result=mrCancel then Result:=mrAbort;
// try loading the ancestor first (unit, lfm and component instance)
if (AncestorType=nil) then begin
Result:=DoLoadComponentDependencyHidden(AnUnitInfo,AncestorClassName,OpenFlags,
AncestorType,AncestorUnitInfo);
if Result=mrAbort then exit;
if Result=mrOk then begin
Result:=DoSaveFileResourceToBinStream(AncestorUnitInfo,AncestorBinStream);
if Result<>mrOk then exit;
ComponentLoadingOk:=false;
AncestorBinStream.Position:=0;
end else begin
// the ancestor class was not found -> use TForm as default
AncestorType:=TForm;
AncestorUnitInfo:=nil;
end;
end;
finally
TxtLFMStream.Free;
end;
if ComponentLoadingOk then begin
// use TForm as default ancestor
if AncestorType=nil then
AncestorType:=TForm;
//DebugLn('TMainIDE.DoLoadLFM Filename="',AnUnitInfo.Filename,'" AncestorClassName=',AncestorClassName,' AncestorType=',AncestorType.ClassName);
BinStream:=TExtMemoryStream.Create;
TxtLFMStream:=TExtMemoryStream.Create;
try
LFMBuf.SaveToStream(TxtLFMStream);
AnUnitInfo.ComponentLastLFMStreamSize:=TxtLFMStream.Size;
TxtLFMStream.Position:=0;
// convert text to binary format
try
if AnUnitInfo.ComponentLastBinStreamSize>0 then
BinStream.Capacity:=AnUnitInfo.ComponentLastBinStreamSize+BufSize;
LRSObjectTextToBinary(TxtLFMStream,BinStream);
AnUnitInfo.ComponentLastBinStreamSize:=BinStream.Size;
BinStream.Position:=0;
Result:=mrOk;
except
on E: Exception do begin
DumpExceptionBackTrace;
ACaption:=lisFormatError;
AText:=Format(lisUnableToConvertTextFormDataOfFileIntoBinaryStream,
[#13, '"', LFMBuf.Filename, '"', #13, E.Message]);
Result:=MessageDlg(ACaption, AText, mtError, [mbOk, mbCancel], 0);
if Result=mrCancel then Result:=mrAbort;
exit;
end;
end;
finally
TxtLFMStream.Free;
end;
if ([ofProjectLoading,ofLoadHiddenResource]*OpenFlags=[]) then
FormEditor1.ClearSelection;
@ -4934,36 +4932,44 @@ begin
if Result=mrOk then Result:=mrCancel;
exit;
end;
FormEditor1.CreateComponentInterface(NewComponent,true);
DebugLn('SUCCESS: streaming lfm="',LFMBuf.Filename,'"');
AnUnitInfo.ComponentName:=NewComponent.Name;
AnUnitInfo.ComponentResourceName:=AnUnitInfo.ComponentName;
DesignerForm:=nil;
if not (ofLoadHiddenResource in OpenFlags) then begin
CreateDesignerForComponent(NewComponent);
DesignerForm:=FormEditor1.GetDesignerForm(AnUnitInfo.Component);
end;
// select the new form (object inspector, formeditor, control selection)
if ([ofProjectLoading,ofLoadHiddenResource]*OpenFlags=[]) then begin
FDisplayState:= dsForm;
GlobalDesignHook.LookupRoot := NewComponent;
TheControlSelection.AssignPersistent(NewComponent);
end;
// show new form
if DesignerForm<>nil then begin
LCLIntf.ShowWindow(DesignerForm.Handle,SW_SHOWNORMAL);
FLastFormActivated:=DesignerForm;
end;
finally
BinStream.Free;
AncestorBinStream.Free;
end;
{$IFDEF IDE_DEBUG}
debugln('[TMainIDE.DoLoadLFM] LFM end');
{$ENDIF}
finally
BinStream.Free;
AncestorBinStream.Free;
end else begin
// keep old instance, just add a designer
NewComponent:=AnUnitInfo.Component;
end;
// create the designer
if ([ofProjectLoading,ofLoadHiddenResource]*OpenFlags=[]) then
FormEditor1.ClearSelection;
FormEditor1.CreateComponentInterface(NewComponent,true);
DebugLn('SUCCESS: streaming lfm="',LFMBuf.Filename,'"');
AnUnitInfo.ComponentName:=NewComponent.Name;
AnUnitInfo.ComponentResourceName:=AnUnitInfo.ComponentName;
DesignerForm:=nil;
if not (ofLoadHiddenResource in OpenFlags) then begin
CreateDesignerForComponent(NewComponent);
DesignerForm:=FormEditor1.GetDesignerForm(AnUnitInfo.Component);
end;
// select the new form (object inspector, formeditor, control selection)
if ([ofProjectLoading,ofLoadHiddenResource]*OpenFlags=[]) then begin
FDisplayState:=dsForm;
GlobalDesignHook.LookupRoot:=NewComponent;
TheControlSelection.AssignPersistent(NewComponent);
end;
// show new form
if DesignerForm<>nil then begin
LCLIntf.ShowWindow(DesignerForm.Handle,SW_SHOWNORMAL);
FLastFormActivated:=DesignerForm;
end;
{$IFDEF IDE_DEBUG}
debugln('[TMainIDE.DoLoadLFM] LFM end');
{$ENDIF}
Result:=mrOk;
end;
@ -6148,7 +6154,8 @@ var
// -> close form
Result:=CloseUnitComponent(NewUnitInfo,
[cfCloseDependencies,cfSaveDependencies]);
end;
end else
Result:=mrOk;
end;

View File

@ -8,6 +8,8 @@ object UnitInfoDialog: TUnitInfoDialog
ActiveControl = OkButton
BorderStyle = bsSizeToolWin
Caption = 'UnitInfoDialog'
ClientHeight = 283
ClientWidth = 500
OnCreate = FormCreate
Position = poScreenCenter
object OkButton: TBitBtn
@ -37,6 +39,8 @@ object UnitInfoDialog: TUnitInfoDialog
PageIndex = 0
object GeneralPage: TPage
Caption = 'GeneralPage'
ClientWidth = 484
ClientHeight = 196
object ULines: TLabel
Left = 12
Height = 13
@ -214,6 +218,8 @@ object UnitInfoDialog: TUnitInfoDialog
end
object UnitPathsPage: TPage
Caption = 'UnitPathsPage'
ClientWidth = 484
ClientHeight = 196
object UnitPathMemo: TMemo
Left = 6
Height = 184
@ -228,6 +234,8 @@ object UnitInfoDialog: TUnitInfoDialog
end
object IncludePathsPage: TPage
Caption = 'IncludePathsPage'
ClientWidth = 484
ClientHeight = 196
object IncludePathMemo: TMemo
Left = 6
Height = 184
@ -242,6 +250,8 @@ object UnitInfoDialog: TUnitInfoDialog
end
object CompleteUnitPathsPage: TPage
Caption = 'CompleteUnitPathsPage'
ClientWidth = 484
ClientHeight = 196
object SrcPathMemo: TMemo
Left = 6
Height = 184

View File

@ -4,83 +4,86 @@ LazarusResources.Add('TUnitInfoDialog','FORMDATA',[
'TPF0'#15'TUnitInfoDialog'#14'UnitInfoDialog'#4'Left'#3']'#1#6'Height'#3#27#1
+#3'Top'#3#244#0#5'Width'#3#244#1#18'HorzScrollBar.Page'#3#243#1#18'VertScrol'
+'lBar.Page'#3#26#1#13'ActiveControl'#7#8'OkButton'#11'BorderStyle'#7#13'bsSi'
+'zeToolWin'#7'Caption'#6#14'UnitInfoDialog'#8'OnCreate'#7#10'FormCreate'#8'P'
+'osition'#7#14'poScreenCenter'#0#7'TBitBtn'#8'OkButton'#4'Left'#3#183#1#6'He'
+'ight'#2#28#3'Top'#3#242#0#5'Width'#2'7'#7'Anchors'#11#7'akRight'#8'akBottom'
+#0#8'AutoSize'#9#6'Cancel'#9#7'Caption'#6#3'&OK'#7'Default'#9#4'Kind'#7#4'bk'
+'OK'#11'ModalResult'#2#1#9'NumGlyphs'#2#0#7'OnClick'#7#13'OkButtonClick'#8'T'
+'abOrder'#2#0#0#0#9'TNotebook'#8'Notebook'#4'Left'#2#6#6'Height'#3#226#0#3'T'
+'op'#2#6#5'Width'#3#232#1#5'Align'#7#5'alTop'#7'Anchors'#11#5'akTop'#6'akLef'
+'t'#7'akRight'#8'akBottom'#0#20'BorderSpacing.Around'#2#6#9'PageIndex'#2#0#0
+#5'TPage'#11'GeneralPage'#7'Caption'#6#11'GeneralPage'#0#6'TLabel'#6'ULines'
+#4'Left'#2#12#6'Height'#2#13#3'Top'#2'\'#5'Width'#2''''#9'Alignment'#7#14'ta'
+'RightJustify'#7'Caption'#6#6'ULines'#5'Color'#7#6'clNone'#10'Font.Style'#11
+#6'fsBold'#0#11'ParentColor'#8#0#0#6'TLabel'#8'OutLines'#22'AnchorSideLeft.C'
+'ontrol'#7#6'ULines'#19'AnchorSideLeft.Side'#7#9'asrBottom'#4'Left'#2'?'#6'H'
+'eight'#2#13#3'Top'#2'\'#5'Width'#2'3'#18'BorderSpacing.Left'#2#12#7'Caption'
+#6#8'OutLines'#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6'TLabel'#7'OutPat'
+'h'#22'AnchorSideLeft.Control'#7#5'UPath'#19'AnchorSideLeft.Side'#7#9'asrBot'
+'tom'#4'Left'#2':'#6'Height'#2#13#3'Top'#2'p'#5'Width'#2'.'#18'BorderSpacing'
+'.Left'#2#12#7'Caption'#6#7'OutPath'#5'Color'#7#6'clNone'#11'ParentColor'#8#0
+#0#6'TLabel'#5'UPath'#4'Left'#2#12#6'Height'#2#13#3'Top'#2'p'#5'Width'#2'"'#9
+'Alignment'#7#14'taRightJustify'#7'Caption'#6#5'UPath'#5'Color'#7#6'clNone'
+#10'Font.Style'#11#6'fsBold'#0#11'ParentColor'#8#0#0#6'TLabel'#11'UIncludedB'
+'y'#4'Left'#2#12#6'Height'#2#13#3'Top'#3#132#0#5'Width'#2'H'#9'Alignment'#7
+#14'taRightJustify'#7'Caption'#6#11'UIncludedBy'#5'Color'#7#6'clNone'#10'Fon'
+'t.Style'#11#6'fsBold'#0#11'ParentColor'#8#0#0#6'TLabel'#13'OutIncludedBy'#22
+'AnchorSideLeft.Control'#7#11'UIncludedBy'#19'AnchorSideLeft.Side'#7#9'asrBo'
+'ttom'#4'Left'#2'`'#6'Height'#2#13#3'Top'#3#132#0#5'Width'#2'T'#18'BorderSpa'
+'cing.Left'#2#12#7'Caption'#6#13'OutIncludedBy'#5'Color'#7#6'clNone'#11'Pare'
+'ntColor'#8#0#0#6'TLabel'#7'OutSize'#22'AnchorSideLeft.Control'#7#5'USize'#19
+'AnchorSideLeft.Side'#7#9'asrBottom'#4'Left'#2'9'#6'Height'#2#13#3'Top'#2'H'
+#5'Width'#2'-'#18'BorderSpacing.Left'#2#12#7'Caption'#6#7'OutSize'#5'Color'#7
+#6'clNone'#11'ParentColor'#8#0#0#6'TLabel'#5'USize'#4'Left'#2#12#6'Height'#2
+#13#3'Top'#2'H'#5'Width'#2'!'#9'Alignment'#7#14'taRightJustify'#7'Caption'#6
+#5'USize'#5'Color'#7#6'clNone'#10'Font.Style'#11#6'fsBold'#0#11'ParentColor'
+#8#0#0#6'TLabel'#10'UInProject'#4'Left'#2#12#6'Height'#2#13#3'Top'#2'4'#5'Wi'
+'dth'#2':'#9'Alignment'#7#14'taRightJustify'#7'Caption'#6#10'UInProject'#5'C'
+'olor'#7#6'clNone'#10'Font.Style'#11#6'fsBold'#0#11'ParentColor'#8#0#0#6'TLa'
+'bel'#12'OutInProject'#22'AnchorSideLeft.Control'#7#10'UInProject'#19'Anchor'
+'SideLeft.Side'#7#9'asrBottom'#4'Left'#2'R'#6'Height'#2#13#3'Top'#2'4'#5'Wid'
+'th'#2'F'#18'BorderSpacing.Left'#2#12#7'Caption'#6#12'OutInProject'#5'Color'
+#7#6'clNone'#11'ParentColor'#8#0#0#6'TLabel'#7'OutType'#22'AnchorSideLeft.Co'
+'ntrol'#7#5'UType'#19'AnchorSideLeft.Side'#7#9'asrBottom'#4'Left'#2'='#6'Hei'
+'ght'#2#13#3'Top'#2' '#5'Width'#2'1'#18'BorderSpacing.Left'#2#12#7'Caption'#6
+#7'OutType'#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6'TLabel'#5'UType'#4
+'Left'#2#12#6'Height'#2#13#3'Top'#2' '#5'Width'#2'%'#9'Alignment'#7#14'taRig'
+'htJustify'#7'Caption'#6#5'UType'#5'Color'#7#6'clNone'#10'Font.Style'#11#6'f'
+'sBold'#0#11'ParentColor'#8#0#0#6'TLabel'#7'OutName'#22'AnchorSideLeft.Contr'
+'ol'#7#5'UName'#19'AnchorSideLeft.Side'#7#9'asrBottom'#4'Left'#2'A'#6'Height'
+#2#13#3'Top'#2#12#5'Width'#2'5'#18'BorderSpacing.Left'#2#12#7'Caption'#6#7'O'
+'utName'#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6'TLabel'#5'UName'#4'Lef'
+'t'#2#12#6'Height'#2#13#3'Top'#2#12#5'Width'#2')'#9'Alignment'#7#14'taRightJ'
+'ustify'#7'Caption'#6#5'UName'#5'Color'#7#6'clNone'#10'Font.Style'#11#6'fsBo'
+'ld'#0#11'ParentColor'#8#0#0#7'TButton'#15'ClearIncludedBy'#21'AnchorSideTop'
+'.Control'#7#11'UIncludedBy'#4'Left'#2#12#6'Height'#2#26#3'Top'#3#152#0#5'Wi'
+'dth'#2'k'#8'AutoSize'#9#17'BorderSpacing.Top'#2#20#25'BorderSpacing.InnerBo'
+'rder'#2#4#7'Caption'#6#15'ClearIncludedBy'#7'OnClick'#7#20'clearIncludedByC'
+'lick'#8'TabOrder'#2#0#0#0#0#5'TPage'#13'UnitPathsPage'#7'Caption'#6#13'Unit'
+'PathsPage'#0#5'TMemo'#12'UnitPathMemo'#4'Left'#2#6#6'Height'#3#184#0#3'Top'
+#2#6#5'Width'#3#216#1#5'Align'#7#8'alClient'#20'BorderSpacing.Around'#2#6#8
+'ReadOnly'#9#10'ScrollBars'#7#10'ssAutoBoth'#8'TabOrder'#2#0#0#0#0#5'TPage'
+#16'IncludePathsPage'#7'Caption'#6#16'IncludePathsPage'#0#5'TMemo'#15'Includ'
+'ePathMemo'#4'Left'#2#6#6'Height'#3#184#0#3'Top'#2#6#5'Width'#3#216#1#5'Alig'
,'n'#7#8'alClient'#20'BorderSpacing.Around'#2#6#8'ReadOnly'#9#10'ScrollBars'#7
+#10'ssAutoBoth'#8'TabOrder'#2#0#0#0#0#5'TPage'#21'CompleteUnitPathsPage'#7'C'
+'aption'#6#21'CompleteUnitPathsPage'#0#5'TMemo'#11'SrcPathMemo'#4'Left'#2#6#6
+'Height'#3#184#0#3'Top'#2#6#5'Width'#3#216#1#5'Align'#7#8'alClient'#20'Borde'
+'rSpacing.Around'#2#6#8'ReadOnly'#9#10'ScrollBars'#7#10'ssAutoBoth'#8'TabOrd'
+'er'#2#0#0#0#0#0#7'TButton'#19'CodeToolsDefsButton'#21'AnchorSideTop.Control'
+#7#8'OkButton'#24'AnchorSideBottom.Control'#7#8'OkButton'#21'AnchorSideBotto'
+'m.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#28#3'Top'#3#242#0#5'Width'#3
+#134#0#7'Anchors'#11#5'akTop'#6'akLeft'#8'akBottom'#0#8'AutoSize'#9#25'Borde'
+'rSpacing.InnerBorder'#2#4#7'Caption'#6#19'CodeToolsDefsButton'#7'OnClick'#7
+#24'CodeToolsDefsButtonClick'#8'TabOrder'#2#2#0#0#7'TButton'#26'GotoIncludeD'
+'irectiveButton'#21'AnchorSideTop.Control'#7#8'OkButton'#23'AnchorSideRight.'
+'Control'#7#8'OkButton'#24'AnchorSideBottom.Control'#7#8'OkButton'#21'Anchor'
+'SideBottom.Side'#7#9'asrBottom'#4'Left'#3#7#1#6'Height'#2#28#3'Top'#3#242#0
+#5'Width'#3#166#0#7'Anchors'#11#5'akTop'#7'akRight'#8'akBottom'#0#8'AutoSize'
+#9#19'BorderSpacing.Right'#2#10#25'BorderSpacing.InnerBorder'#2#4#7'Caption'
+#6#26'GotoIncludeDirectiveButton'#11'ModalResult'#2#6#7'OnClick'#7#31'GotoIn'
+'cludeDirectiveButtonClick'#8'TabOrder'#2#3#0#0#0
+'zeToolWin'#7'Caption'#6#14'UnitInfoDialog'#12'ClientHeight'#3#27#1#11'Clien'
+'tWidth'#3#244#1#8'OnCreate'#7#10'FormCreate'#8'Position'#7#14'poScreenCente'
+'r'#0#7'TBitBtn'#8'OkButton'#4'Left'#3#183#1#6'Height'#2#28#3'Top'#3#242#0#5
+'Width'#2'7'#7'Anchors'#11#7'akRight'#8'akBottom'#0#8'AutoSize'#9#6'Cancel'#9
+#7'Caption'#6#3'&OK'#7'Default'#9#4'Kind'#7#4'bkOK'#11'ModalResult'#2#1#9'Nu'
+'mGlyphs'#2#0#7'OnClick'#7#13'OkButtonClick'#8'TabOrder'#2#0#0#0#9'TNotebook'
+#8'Notebook'#4'Left'#2#6#6'Height'#3#226#0#3'Top'#2#6#5'Width'#3#232#1#5'Ali'
+'gn'#7#5'alTop'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#20
+'BorderSpacing.Around'#2#6#9'PageIndex'#2#0#0#5'TPage'#11'GeneralPage'#7'Cap'
+'tion'#6#11'GeneralPage'#11'ClientWidth'#3#228#1#12'ClientHeight'#3#196#0#0#6
+'TLabel'#6'ULines'#4'Left'#2#12#6'Height'#2#13#3'Top'#2'\'#5'Width'#2''''#9
+'Alignment'#7#14'taRightJustify'#7'Caption'#6#6'ULines'#5'Color'#7#6'clNone'
+#10'Font.Style'#11#6'fsBold'#0#11'ParentColor'#8#0#0#6'TLabel'#8'OutLines'#22
+'AnchorSideLeft.Control'#7#6'ULines'#19'AnchorSideLeft.Side'#7#9'asrBottom'#4
+'Left'#2'?'#6'Height'#2#13#3'Top'#2'\'#5'Width'#2'3'#18'BorderSpacing.Left'#2
+#12#7'Caption'#6#8'OutLines'#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6'TL'
+'abel'#7'OutPath'#22'AnchorSideLeft.Control'#7#5'UPath'#19'AnchorSideLeft.Si'
+'de'#7#9'asrBottom'#4'Left'#2':'#6'Height'#2#13#3'Top'#2'p'#5'Width'#2'.'#18
+'BorderSpacing.Left'#2#12#7'Caption'#6#7'OutPath'#5'Color'#7#6'clNone'#11'Pa'
+'rentColor'#8#0#0#6'TLabel'#5'UPath'#4'Left'#2#12#6'Height'#2#13#3'Top'#2'p'
+#5'Width'#2'"'#9'Alignment'#7#14'taRightJustify'#7'Caption'#6#5'UPath'#5'Col'
+'or'#7#6'clNone'#10'Font.Style'#11#6'fsBold'#0#11'ParentColor'#8#0#0#6'TLabe'
+'l'#11'UIncludedBy'#4'Left'#2#12#6'Height'#2#13#3'Top'#3#132#0#5'Width'#2'H'
+#9'Alignment'#7#14'taRightJustify'#7'Caption'#6#11'UIncludedBy'#5'Color'#7#6
+'clNone'#10'Font.Style'#11#6'fsBold'#0#11'ParentColor'#8#0#0#6'TLabel'#13'Ou'
+'tIncludedBy'#22'AnchorSideLeft.Control'#7#11'UIncludedBy'#19'AnchorSideLeft'
+'.Side'#7#9'asrBottom'#4'Left'#2'`'#6'Height'#2#13#3'Top'#3#132#0#5'Width'#2
+'T'#18'BorderSpacing.Left'#2#12#7'Caption'#6#13'OutIncludedBy'#5'Color'#7#6
+'clNone'#11'ParentColor'#8#0#0#6'TLabel'#7'OutSize'#22'AnchorSideLeft.Contro'
+'l'#7#5'USize'#19'AnchorSideLeft.Side'#7#9'asrBottom'#4'Left'#2'9'#6'Height'
+#2#13#3'Top'#2'H'#5'Width'#2'-'#18'BorderSpacing.Left'#2#12#7'Caption'#6#7'O'
+'utSize'#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6'TLabel'#5'USize'#4'Lef'
+'t'#2#12#6'Height'#2#13#3'Top'#2'H'#5'Width'#2'!'#9'Alignment'#7#14'taRightJ'
+'ustify'#7'Caption'#6#5'USize'#5'Color'#7#6'clNone'#10'Font.Style'#11#6'fsBo'
+'ld'#0#11'ParentColor'#8#0#0#6'TLabel'#10'UInProject'#4'Left'#2#12#6'Height'
+#2#13#3'Top'#2'4'#5'Width'#2':'#9'Alignment'#7#14'taRightJustify'#7'Caption'
+#6#10'UInProject'#5'Color'#7#6'clNone'#10'Font.Style'#11#6'fsBold'#0#11'Pare'
+'ntColor'#8#0#0#6'TLabel'#12'OutInProject'#22'AnchorSideLeft.Control'#7#10'U'
+'InProject'#19'AnchorSideLeft.Side'#7#9'asrBottom'#4'Left'#2'R'#6'Height'#2
+#13#3'Top'#2'4'#5'Width'#2'F'#18'BorderSpacing.Left'#2#12#7'Caption'#6#12'Ou'
+'tInProject'#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6'TLabel'#7'OutType'
+#22'AnchorSideLeft.Control'#7#5'UType'#19'AnchorSideLeft.Side'#7#9'asrBottom'
+#4'Left'#2'='#6'Height'#2#13#3'Top'#2' '#5'Width'#2'1'#18'BorderSpacing.Left'
+#2#12#7'Caption'#6#7'OutType'#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6'T'
+'Label'#5'UType'#4'Left'#2#12#6'Height'#2#13#3'Top'#2' '#5'Width'#2'%'#9'Ali'
+'gnment'#7#14'taRightJustify'#7'Caption'#6#5'UType'#5'Color'#7#6'clNone'#10
+'Font.Style'#11#6'fsBold'#0#11'ParentColor'#8#0#0#6'TLabel'#7'OutName'#22'An'
+'chorSideLeft.Control'#7#5'UName'#19'AnchorSideLeft.Side'#7#9'asrBottom'#4'L'
+'eft'#2'A'#6'Height'#2#13#3'Top'#2#12#5'Width'#2'5'#18'BorderSpacing.Left'#2
+#12#7'Caption'#6#7'OutName'#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6'TLa'
+'bel'#5'UName'#4'Left'#2#12#6'Height'#2#13#3'Top'#2#12#5'Width'#2')'#9'Align'
+'ment'#7#14'taRightJustify'#7'Caption'#6#5'UName'#5'Color'#7#6'clNone'#10'Fo'
+'nt.Style'#11#6'fsBold'#0#11'ParentColor'#8#0#0#7'TButton'#15'ClearIncludedB'
+'y'#21'AnchorSideTop.Control'#7#11'UIncludedBy'#4'Left'#2#12#6'Height'#2#26#3
+'Top'#3#152#0#5'Width'#2'k'#8'AutoSize'#9#17'BorderSpacing.Top'#2#20#25'Bord'
+'erSpacing.InnerBorder'#2#4#7'Caption'#6#15'ClearIncludedBy'#7'OnClick'#7#20
+'clearIncludedByClick'#8'TabOrder'#2#0#0#0#0#5'TPage'#13'UnitPathsPage'#7'Ca'
+'ption'#6#13'UnitPathsPage'#11'ClientWidth'#3#228#1#12'ClientHeight'#3#196#0
+#0#5'TMemo'#12'UnitPathMemo'#4'Left'#2#6#6'Height'#3#184#0#3'Top'#2#6#5'Widt'
+'h'#3#216#1#5'Align'#7#8'alClient'#20'BorderSpacing.Around'#2#6#8'ReadOnly'#9
+#10'ScrollBars'#7#10'ssAutoBoth'#8'TabOrder'#2#0#0#0#0#5'TPage'#16'IncludePa'
,'thsPage'#7'Caption'#6#16'IncludePathsPage'#11'ClientWidth'#3#228#1#12'Clien'
+'tHeight'#3#196#0#0#5'TMemo'#15'IncludePathMemo'#4'Left'#2#6#6'Height'#3#184
+#0#3'Top'#2#6#5'Width'#3#216#1#5'Align'#7#8'alClient'#20'BorderSpacing.Aroun'
+'d'#2#6#8'ReadOnly'#9#10'ScrollBars'#7#10'ssAutoBoth'#8'TabOrder'#2#0#0#0#0#5
+'TPage'#21'CompleteUnitPathsPage'#7'Caption'#6#21'CompleteUnitPathsPage'#11
+'ClientWidth'#3#228#1#12'ClientHeight'#3#196#0#0#5'TMemo'#11'SrcPathMemo'#4
+'Left'#2#6#6'Height'#3#184#0#3'Top'#2#6#5'Width'#3#216#1#5'Align'#7#8'alClie'
+'nt'#20'BorderSpacing.Around'#2#6#8'ReadOnly'#9#10'ScrollBars'#7#10'ssAutoBo'
+'th'#8'TabOrder'#2#0#0#0#0#0#7'TButton'#19'CodeToolsDefsButton'#21'AnchorSid'
+'eTop.Control'#7#8'OkButton'#24'AnchorSideBottom.Control'#7#8'OkButton'#21'A'
+'nchorSideBottom.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#28#3'Top'#3#242
+#0#5'Width'#3#134#0#7'Anchors'#11#5'akTop'#6'akLeft'#8'akBottom'#0#8'AutoSiz'
+'e'#9#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#19'CodeToolsDefsButton'
+#7'OnClick'#7#24'CodeToolsDefsButtonClick'#8'TabOrder'#2#2#0#0#7'TButton'#26
+'GotoIncludeDirectiveButton'#21'AnchorSideTop.Control'#7#8'OkButton'#23'Anch'
+'orSideRight.Control'#7#8'OkButton'#24'AnchorSideBottom.Control'#7#8'OkButto'
+'n'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#3#7#1#6'Height'#2#28#3
+'Top'#3#242#0#5'Width'#3#166#0#7'Anchors'#11#5'akTop'#7'akRight'#8'akBottom'
+#0#8'AutoSize'#9#19'BorderSpacing.Right'#2#10#25'BorderSpacing.InnerBorder'#2
+#4#7'Caption'#6#26'GotoIncludeDirectiveButton'#11'ModalResult'#2#6#7'OnClick'
+#7#31'GotoIncludeDirectiveButtonClick'#8'TabOrder'#2#3#0#0#0
]);

View File

@ -150,8 +150,9 @@ begin
ULines.Caption:=lisUIDLines;
UPath.Caption:=lisToFPCPath;
UIncludedBy.Caption:=lisUIDIncludedBy;
ClearIncludedBy.Caption := 'Clear included by reference';
ClearIncludedBy.Caption:=lisUIClearIncludedByReference;
CodeToolsDefsButton.Caption:=lisUIShowCodeToolsValues;
GotoIncludeDirectiveButton.Caption:=lisMenuGotoIncludeDirective;
end;
procedure TUnitInfoDialog.GotoIncludeDirectiveButtonClick(Sender: TObject);

View File

@ -446,6 +446,7 @@ type
private
FCanUTF8: boolean;
FHandle: HFont;
FIsMonoSpace: boolean;
FPitch: TFontPitch;
FStyle: TFontStylesBase;
FCharSet: TFontCharSet;
@ -501,6 +502,7 @@ type
property Handle: HFONT read GetHandle write SetHandle;
property PixelsPerInch: Integer read FPixelsPerInch write FPixelsPerInch;
property CanUTF8: boolean read FCanUTF8;
property IsMonoSpace: boolean read FIsMonoSpace;
published
property CharSet: TFontCharSet read GetCharSet write SetCharSet default DEFAULT_CHARSET;
property Color: TColor read FColor write SetColor default clWindowText;

View File

@ -1043,6 +1043,7 @@ begin
end;
FFontHandleCached:=true;
FCanUTF8:=FontCanUTF8(FHandle);
FIsMonoSpace:=FontIsMonoSpace(FHandle);
end;
Result := FHandle;

View File

@ -150,6 +150,11 @@ begin
Result:=false;
end;
function TWidgetSet.FontIsMonoSpace(Font: HFont): boolean;
begin
Result:=false;
end;
function TWidgetSet.Frame(DC: HDC; const ARect: TRect) : integer;
begin
Result:= 0;

View File

@ -147,6 +147,11 @@ begin
Result := WidgetSet.FontCanUTF8(Font);
end;
function FontIsMonoSpace(Font: HFont): boolean;
begin
Result := WidgetSet.FontIsMonoSpace(Font);
end;
function Frame(DC: HDC; const ARect: TRect): Integer;
begin
Result := WidgetSet.Frame(DC, ARect);

View File

@ -66,6 +66,7 @@ function ExtUTF8Out(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str:
function TextUTF8Out(DC: HDC; X, Y: Integer; Str: PChar; Count: Longint): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function FontCanUTF8(Font: HFont): boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function FontIsMonoSpace(Font: HFont): boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function Frame(DC: HDC; const ARect: TRect): Integer; {$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

@ -3038,8 +3038,8 @@ begin
// if the format was wrapped, transform it back
if (FormatID=gdk_atom_intern('text/plain',GdkTrue)) then begin
if (SelectionData^.Target=gdk_atom_intern('COMPOUND_TEXT',GdkTrue)) then
begin
if (SelectionData^.Target=gdk_atom_intern('COMPOUND_TEXT',GdkTrue))
then begin
// transform text/plain to COMPOUND_TEXT
BufLength:=integer(MemStream.Size);
P:=StrAlloc(BufLength+1);

View File

@ -159,6 +159,7 @@ type
rBearing: LongInt;
TextMetric: TTextMetric;
IsDoubleByteChar: boolean;
IsMonoSpace: boolean;
end;
TDeviceContextsFlag = (

View File

@ -42,6 +42,7 @@ type
rBearing: LongInt;
TextMetric: TTextMetric;
IsDoubleByteChar: boolean;
IsMonoSpace: boolean;
procedure WarnReferenceHigh; override;
end;

View File

@ -285,7 +285,7 @@ end;
{------------------------------------------------------------------------------
function TGTKWidgetSet.FontCanUTF8(Font: HFont): boolean;
True if font recognizes Unicode.
True if font recognizes Unicode UTF8 encoding.
------------------------------------------------------------------------------}
function TGTKWidgetSet.FontCanUTF8(Font: HFont): boolean;
begin
@ -296,6 +296,17 @@ begin
;
end;
{------------------------------------------------------------------------------
function TGTKWidgetSet.FontIsMonoSpace(Font: HFont): boolean;
True if font characters have all the same width.
------------------------------------------------------------------------------}
function TGTKWidgetSet.FontIsMonoSpace(Font: HFont): boolean;
begin
Result:=IsValidGDIObject(Font)
and FontIsMonoSpaceFont(PGdiObject(Font)^.GDIFontObject);
end;
{------------------------------------------------------------------------------
Function: GetAcceleratorString
Params: AVKey:

View File

@ -43,6 +43,7 @@ function ExtUTF8Out(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect;
function TextUTF8Out(DC: HDC; X, Y: Integer; Str: PChar; Count: Longint): Boolean; override;
function FontCanUTF8(Font: HFont): boolean; override;
function FontIsMonoSpace(Font: HFont): boolean; override;
function GetAcceleratorString(const AVKey: Byte; const AShiftState: TShiftState): String; override;
function GetControlConstraints(Constraints: TObject): boolean; override;

View File

@ -6647,10 +6647,12 @@ begin
DCTextMetric.lBearing:=CachedFont.lBearing;
DCTextMetric.rBearing:=CachedFont.rBearing;
DCTextMetric.IsDoubleByteChar:=CachedFont.IsDoubleByteChar;
DCTextMetric.IsMonoSpace:=CachedFont.IsMonoSpace;
DCTextMetric.TextMetric:=CachedFont.TextMetric;
end
else with DCTextMetric do begin
IsDoubleByteChar:=FontIsDoubleByteCharsFont(UseFont);
IsMonoSpace:=FontIsMonoSpaceFont(UseFont);
{$IFDEF Gtk1}
AvgTxtLen:=length(TestString[false]);
if IsDoubleByteChar then begin
@ -6751,6 +6753,7 @@ begin
CachedFont.lBearing:=lBearing;
CachedFont.rBearing:=rBearing;
CachedFont.IsDoubleByteChar:=IsDoubleByteChar;
CachedFont.IsMonoSpace:=IsMonoSpace;
CachedFont.TextMetric:=TextMetric;
CachedFont.MetricsValid:=true;
end;

View File

@ -981,6 +981,7 @@ begin
end;
procedure SetWindowFullScreen(AForm: TCustomForm; const AValue: Boolean);
{$IFDEF GTK1}
var
XDisplay: PDisplay;
XScreen: PScreen;
@ -993,6 +994,7 @@ var
//_NET_WM_STATE_FULLSCREEN: Integer;
_NET_WM_STATE_ATOMS: array [0..2] of Integer;
I: Integer;
{$ENDIF}
begin
{$IFDEF GTK2}
If AValue then
@ -8264,7 +8266,7 @@ end;
{------------------------------------------------------------------------------
function FontIsDoubleByteCharsFont(TheFont: PGdkFont): boolean;
This is only a heuristic
------------------------------------------------------------------------------}
function FontIsDoubleByteCharsFont(TheFont: PGdkFont): boolean;
@ -8276,6 +8278,30 @@ begin
Result:=(SingleCharLen=0) and (DoubleCharLen>0);
end;
{------------------------------------------------------------------------------
function FontIsMonoSpaceFont(TheFont: PGdkFont): boolean;
This is only a heuristic
------------------------------------------------------------------------------}
function FontIsMonoSpaceFont(TheFont: PGdkFont): boolean;
var
SingleCharLen: LongInt;
MWidth: LongInt;
IWidth: LongInt;
begin
SingleCharLen:=gdk_text_width(TheFont, 'A', 1);
if SingleCharLen=0 then begin
// assume a double byte character font
MWidth:=gdk_text_width(TheFont, '#0m', 2);
IWidth:=gdk_text_width(TheFont, '#0i', 2);
end else begin
// assume a single byte character font
MWidth:=gdk_text_width(TheFont, 'm', 1);
IWidth:=gdk_text_width(TheFont, 'i', 1);
end;
Result:=MWidth=IWidth;
end;
{$Ifdef GTK2}
function FontIsDoubleByteCharsFont(TheFont: PPangoFontDescription): boolean;
var
@ -8285,6 +8311,15 @@ begin
Result:=FontIsDoubleByteCharsFont(Font);
gdk_font_unref(Font);
end;
function FontIsMonoSpaceFont(TheFont: PPangoFontDescription): boolean;
var
Font: PGdkFont;
begin
Font:=gdk_font_from_description(TheFont);
Result:=FontIsMonoSpaceFont(Font);
gdk_font_unref(Font);
end;
{$ENDIF Gtk2}
{------------------------------------------------------------------------------

View File

@ -781,10 +781,12 @@ Function StyleForegroundColor(Color: TColorRef; DefaultColor: PGDKColor): PGDKCo
procedure UpdateWidgetStyleOfControl(AWinControl: TWinControl);
// fonts
function FontIsDoubleByteCharsFont(TheFont: PGdkFont): boolean;
function LoadDefaultFont: TGtkIntfFont;
function FontIsDoubleByteCharsFont(TheFont: PGdkFont): boolean;
function FontIsMonoSpaceFont(TheFont: PGdkFont): boolean;
{$Ifdef GTK2}
function FontIsDoubleByteCharsFont(TheFont: PPangoFontDescription): boolean;
function FontIsMonoSpaceFont(TheFont: PPangoFontDescription): boolean;
function LoadDefaultFontDesc: PPangoFontDescription;
procedure GetTextExtentIgnoringAmpersands(FontDesc: PPangoFontDescription; Str: PChar;
LineLength: Longint; lbearing, rbearing, width, ascent, descent: Pgint);

View File

@ -62,7 +62,11 @@ begin
Name:='SynEdit1';
Align:=alClient;
Highlighter:=SynPasSyn1;
{$IFDEF LCLGtk}
Font.Name:='-adobe-courier-medium-r-normal-*-*-140-*-*-*-*-iso10646-1';
{$ELSE}
Font.Name:='Monospace';
{$ENDIF}
Font.Size:=10;
Parent:=Self;
end;