From 9203ab6a08e00f226ed5939b9d7770a23b68fa87 Mon Sep 17 00:00:00 2001 From: JianjunLiu Date: Fri, 12 May 2023 10:23:18 +0800 Subject: [PATCH] =?UTF-8?q?=E7=95=8C=E9=9D=A2=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 文本控件字体修正 --- funcext/tvclib/tslvcl.tsf | 8 +------- funcext/tvclib/utslmemo.tsf | 19 +++++++++++++------ funcext/tvclib/utslvclgdi.tsf | 15 +++++++++------ funcext/tvclib/utslvclmemstruct.tsf | 28 ++++++++++++++++++++++++++++ funcext/tvclib/utslvclstdctl.tsf | 11 ++++------- 5 files changed, 55 insertions(+), 26 deletions(-) diff --git a/funcext/tvclib/tslvcl.tsf b/funcext/tvclib/tslvcl.tsf index b38f2d5..3a50a38 100644 --- a/funcext/tvclib/tslvcl.tsf +++ b/funcext/tvclib/tslvcl.tsf @@ -1484,13 +1484,6 @@ type TRadioGroupBox=class(TGroupbox) begin return FGrid.Font; end - function SetControlFont(v);override; - begin - if FGrid then - begin - FGrid.font := v; - end - end function rctoindex(i,j); begin if FColumnLayout=pstHorizontal then return i * Columns+j; @@ -1566,6 +1559,7 @@ type TRadioGroupBox=class(TGroupbox) FColumnLayout := pstHorizontal; border := true; FGrid := new TDrawGrid(self); + FGrid.ParentFont := true; FGrid.border := false; FGrid.ColumnHeader := false; FGrid.GridLine := false; diff --git a/funcext/tvclib/utslmemo.tsf b/funcext/tvclib/utslmemo.tsf index 356a483..559371c 100644 --- a/funcext/tvclib/utslmemo.tsf +++ b/funcext/tvclib/utslmemo.tsf @@ -695,7 +695,8 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) // static smNormal,smLine,smColumn; //**************** protected - function SetControlFont(v);override; + + {function SetControlFont(v);override; begin inherited; FCharWidth := Font.width; @@ -703,7 +704,7 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) // FCharHeight := Font.Height; fTextHeight := FCharHeight+FLineInterval; UpDateScroll(); - end + end} function GetClientXCapacity();override; //¿í¶ÈÈÝÁ¿ begin return integer(ClientRect[2]/GetXScrollDelta()); @@ -1652,6 +1653,16 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) // @param(GutterCharCnt)(integer) ÐкŵĿí¶È%% **} public + function FontChanged(o);override; + begin + inherited; + FCharWidth := Font.width; + FGutter.Width := (5*(FGutterCharCount>0))+FGutterCharCount * FCharWidth+1; + FCharHeight := Font.Height; + fTextHeight := FCharHeight+FLineInterval; + ReCreateCaret(); + UpDateScroll(); + end function UpDateCaret(); //¸üйâ±ê begin if IsUpDating()then return fForceCaret := true; @@ -4322,10 +4333,6 @@ type TSynMemoNorm = class(TsynCustomMemo) // font := array("width":fw+1,"height":font.height+2); end end - if flg then - begin - ReCreateCaret(); - end e.skip := true; return; diff --git a/funcext/tvclib/utslvclgdi.tsf b/funcext/tvclib/utslvclgdi.tsf index 49220b3..35f4584 100644 --- a/funcext/tvclib/utslvclgdi.tsf +++ b/funcext/tvclib/utslvclgdi.tsf @@ -2157,6 +2157,7 @@ type TcustomCanvas = class(TSLUIBASE) FCounter; FTabLength; FTabLenParam; + _xformobj; static FHDC; type TCounter=class private @@ -2726,12 +2727,14 @@ type TcustomCanvas = class(TSLUIBASE) {$ifdef linux} return r; {$endif} - _xformobj._setvalue_("em11",trans[0]); - _xformobj._setvalue_("em12",trans[1]); - _xformobj._setvalue_("em21",trans[2]); - _xformobj._setvalue_("em22",trans[3]); - _xformobj._setvalue_("edx",trans[4]); - _xformobj._setvalue_("edy",trans[5]); + if not _xformobj then + _xformobj := new Ttagxform(); + _xformobj.em11 := trans[0]; + _xformobj.em12 := trans[1]; + _xformobj.em21 := trans[2]; + _xformobj.em22 := trans[3]; + _xformobj.edx := trans[4]; + _xformobj.edy := trans[5]; return _wapi.SetWorldTransform(FHandle,_xformobj._getptr_); end function SetPolyFillMode(md); //ÉèÖÃÌî³äÑùʽ diff --git a/funcext/tvclib/utslvclmemstruct.tsf b/funcext/tvclib/utslvclmemstruct.tsf index 4a1a6de..84a6137 100644 --- a/funcext/tvclib/utslvclmemstruct.tsf +++ b/funcext/tvclib/utslvclmemstruct.tsf @@ -1436,6 +1436,34 @@ type tagCOMPOSITIONFORM=class(tslcstructureobj) private FPonter; end +type Ttagxform=class(tslcstructureobj) + private + static SSTRUCT; + class function getstruct() + begin + if not SSTRUCT then SSTRUCT := MemoryAlignmentCalculate(array( + (0,"float",0), + (1,"float",0), + (2,"float",0), + (3,"float",0), + (4,"float",0), + (5,"float",0) + ) + ); + return SSTRUCT; + end + public + function create(ptr) + begin + inherited create(getstruct(),ptr); + end + property eM11 index 0 read _getvalue_ write _setvalue_; + property eM12 index 1 read _getvalue_ write _setvalue_; + property eM21 index 2 read _getvalue_ write _setvalue_; + property eM22 index 3 read _getvalue_ write _setvalue_; + property edx index 4 read _getvalue_ write _setvalue_; + property edy index 5 read _getvalue_ write _setvalue_; +end implementation (* diff --git a/funcext/tvclib/utslvclstdctl.tsf b/funcext/tvclib/utslvclstdctl.tsf index 62a076e..a3e9531 100644 --- a/funcext/tvclib/utslvclstdctl.tsf +++ b/funcext/tvclib/utslvclstdctl.tsf @@ -2372,14 +2372,11 @@ type TcustomLabel = class(TGraphicControl) InvalidateRect(nil,true); end end - protected - function SetControlFont(v);override; - begin - inherited; - //invalidaterect(nil,true); - invalidaterect(nil,false); - end public + function FontChanged(o);override; + begin + InvalidateRect(nil,false); + end function paint();override; begin dc := canvas;