View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0002011 | JEDI VCL | 00 JVCL Components | public | 2004-07-28 17:42 | 2004-08-20 14:06 |
| Reporter | glchapman | Assigned To | AHUser | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | resolved | Resolution | fixed | ||
| Product Version | |||||
| Target Version | Fixed in Version | ||||
| Summary | 0002011: Make TJvUnicodeCanvas uses unicode text measures | ||||
| Description | TJvUnicodeCanvas calls TextWidth and TextExtent (rather than TextWidthW and TextExtentW) in a couple of places. Attached is a diff to correct this. | ||||
| Tags | No tags attached. | ||||
|
2004-07-28 17:42
|
JvUnicodeCanvas.pas.diff (1,234 bytes)
*** JvUnicodeCanvas.pas.orig Sat Jul 24 22:42:27 2004
--- JvUnicodeCanvas.pas Wed Jul 28 17:38:10 2004
***************
*** 90,96 ****
W: Integer;
begin
Changing;
! W := TextWidth(Text);
if CanvasOrientation = coRightToLeft then
Inc(X, W + 1);
Windows.ExtTextOutW(Handle, X, Y, TextFlags, nil, PWideChar(Text), Length(Text), nil);
--- 90,96 ----
W: Integer;
begin
Changing;
! W := TextWidthW(Text);
if CanvasOrientation = coRightToLeft then
Inc(X, W + 1);
Windows.ExtTextOutW(Handle, X, Y, TextFlags, nil, PWideChar(Text), Length(Text), nil);
***************
*** 114,125 ****
function TJvUnicodeCanvas.TextWidthW(const Text: WideString): Integer;
begin
! Result := TextExtent(Text).cx;
end;
function TJvUnicodeCanvas.TextHeightW(const Text: WideString): Integer;
begin
! Result := TextExtent(Text).cy;
end;
{$ENDIF VCL}
--- 114,125 ----
function TJvUnicodeCanvas.TextWidthW(const Text: WideString): Integer;
begin
! Result := TextExtentW(Text).cx;
end;
function TJvUnicodeCanvas.TextHeightW(const Text: WideString): Integer;
begin
! Result := TextExtentW(Text).cy;
end;
{$ENDIF VCL}
|
|
2004-07-28 18:05
|
JvUnicodeCanvas.pas.diff.2 (1,871 bytes) |
|
|
I missed one use of TextWidth; the newly attached file (*diff.2) adds this correction. |
|
|
Are these functions available in Win9X? |
|
|
The methods in question (TextExtentW and TextWidthW) are methods of TJvUnicodeCanvas, so they are available. Both methods ultimately end up with a call to GetTextExtentPoint32W, and, according to my SDK documentation, that function is implemented as both ANSI and Unicode on all platforms. |
|
|
that was me above (I forgot to log in). |
|
|
Fixed in CVS. Histroy: The first implementation used overloaded methods so the function calls without the "W" were correct. But then a test run with Delphi 5 showed that D5 does not differ between AnsiString and WideString as parameter types. So the overloaded methods got a "W" and the code was not updated. |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2004-07-28 17:42 | glchapman | New Issue | |
| 2004-07-28 17:42 | glchapman | File Added: JvUnicodeCanvas.pas.diff | |
| 2004-07-28 18:05 | glchapman | File Added: JvUnicodeCanvas.pas.diff.2 | |
| 2004-07-28 18:06 | glchapman | Note Added: 0004853 | |
| 2004-07-29 06:11 |
|
Note Added: 0004856 | |
| 2004-07-29 08:53 | anonymous | Note Added: 0004857 | |
| 2004-07-29 08:54 | glchapman | Note Added: 0004858 | |
| 2004-08-20 14:06 | AHUser | Status | new => resolved |
| 2004-08-20 14:06 | AHUser | Resolution | open => fixed |
| 2004-08-20 14:06 | AHUser | Assigned To | => AHUser |
| 2004-08-20 14:06 | AHUser | Note Added: 0005054 |