Changeset 420 for trunk/Components
- Timestamp:
- Feb 28, 2019, 4:17:24 AM (6 years ago)
- Location:
- trunk/Components
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Components/CanvasFontManager.pas
r418 r420 1134 1134 EnsureMetricsLoaded; 1135 1135 GpiQueryTextBox( FCanvas.Handle, Length, S^, TXTBOX_COUNT, aptl[0] ); 1136 // The pad of 2.1 per character was chosen through experimentation, since the 1137 // actual returned value always seems too narrow. I have no idea why. (ALT) 1138 Result := ( 2.1 + aptl[ TXTBOX_BOTTOMRIGHT ].x) * FontWidthPrecisionFactor; 1136 Result := aptl[ TXTBOX_CONCAT ].x * FontWidthPrecisionFactor; 1139 1137 end; 1140 1138 // -
trunk/Components/RichTextDocumentUnit.pas
r418 r420 143 143 const Codepage: LongInt ): boolean; 144 144 145 // Adjusts the character position to the beginning of any multi-byte character. 145 // Adjusts the character position to the beginning or end of any multi-byte 146 // character. 146 147 procedure MoveToCharacterBoundary( TextPointer: PChar; 147 148 var Index: LongInt; 148 149 var Offset: LongInt; 149 150 RowStart: LongInt; 150 Codepage: LongInt ); 151 Codepage: LongInt; 152 Advance: Boolean; ); 151 153 // 152 154 // ALT ends … … 967 969 var Offset: LongInt; 968 970 RowStart: LongInt; 969 Codepage: LongInt ); 971 Codepage: LongInt; 972 Advance: Boolean; ); 970 973 var 971 974 P: PChar; … … 989 992 inc( RowStart ); 990 993 end; 991 { 994 992 995 // We've reached the target position, and the current parsing state should 993 996 // be correctly set. So now we can safely determine the target byte's type. 994 997 Element := ExtractNextTextElement( P, NextP ); 995 998 CheckSpecialElementType( Element.Character, Element.ElementType, InsideDBC, Codepage ); 996 }997 999 if InsideDBC then 998 1000 begin 999 // If this the first byte of a double byte character, move back by one. 1000 dec( Index ); 1001 dec( Offset ); 1001 // If this the first byte of a double byte character, move position by one. 1002 if Advance Then 1003 Begin 1004 inc( Index ); 1005 inc( Offset ); 1006 End 1007 Else 1008 Begin 1009 dec( Index ); 1010 dec( Offset ); 1011 End 1002 1012 end; 1003 1013 end; -
trunk/Components/RichTextLayoutUnit.pas
r418 r420 834 834 begin 835 835 Element := ExtractNextTextElement( P, NextP ); 836 CheckSpecialElementType( Element.Character, Element.ElementType, InsideDBC, Codepage ); // ALT 836 837 // ALT - handle double-byte characters 838 if InsideDBC and ( P < EndP ) then 839 begin 840 P := NextP; 841 Element := ExtractNextTextElement( P, NextP ); 842 InsideDBC := false; 843 end; 844 CheckSpecialElementType( Element.Character, Element.ElementType, InsideDBC, Codepage ); 845 // ALT done 837 846 838 847 case Element.ElementType of -
trunk/Components/RichTextView.PAS
r418 r420 472 472 // ALT 473 473 Offset := FCursorOffset; 474 Move toCharacterBoundary( FText, SelectionStart, FCursorOffset, Offset, FLayout.Codepage );474 MoveToCharacterBoundary( FText, SelectionStart, FCursorOffset, Offset, FLayout.Codepage, false ); 475 475 476 476 FSelectionStart := SelectionStart; … … 493 493 // ALT 494 494 Offset := FCursorOffset; 495 Move toCharacterBoundary( FText, SelectionEnd, FCursorOffset, Offset, FLayout.Codepage );495 MoveToCharacterBoundary( FText, SelectionEnd, FCursorOffset, Offset, FLayout.Codepage, false ); 496 496 497 497 if FSelectionStart = -1 then … … 1230 1230 Descender: longint; 1231 1231 MaxDescender: longint; 1232 Index: longint; // ALT 1233 RowStart: longint; // ALT 1232 1234 begin 1233 1235 RemoveCursor; … … 1252 1254 // off top 1253 1255 exit; 1256 1257 // ALT - move to nearest character boundary 1258 Index := FLayout.GetCharIndex( Line.Text ) + FCursorOffset; 1259 RowStart := FLayout.GetCharIndex( Line.Text ); 1260 MoveToCharacterBoundary( FText, Index, FCursorOffset, RowStart, FLayout.Codepage, false ); 1254 1261 1255 1262 FLayout.GetXFromOffset( FCursorOffset, CursorRow, X ); … … 2035 2042 // InsideDBC: boolean; // ALT 2036 2043 RowStart: longint; // ALT 2044 MoveRight: boolean; // ALT 2037 2045 Index: longint; 2038 2046 begin … … 2067 2075 2068 2076 RowStart := FLayout.GetCharIndex( FLayout.FLines[ Row ].Text ); 2069 MoveToCharacterBoundary( FText, Index, Offset, RowStart, FLayout.Codepage ); // ALT 2077 2078 // ALT 2079 if Offset = ( FCursorOffset + 1 ) then 2080 MoveRight := true 2081 else 2082 MoveRight := false; 2083 MoveToCharacterBoundary( FText, Index, Offset, RowStart, FLayout.Codepage, MoveRight ); 2070 2084 2071 2085 FCursorOffset := Offset;
Note:
See TracChangeset
for help on using the changeset viewer.