ActionTest and WINE

General TRichView support forum. Please post your questions here
Post Reply
therapon
Posts: 8
Joined: Thu Jan 19, 2012 1:55 pm

ActionTest and WINE

Post by therapon »

I'm using ActionTest (latest version) under WINE 1.3.37 on Kubuntu 11.10. The problem is not new, been around for several years; I just haven't gotten around to figuring it out.

ActionTest works fine in WINE using ANSI files/text. Not so with Unicode. If I copy Unicode text and paste it into ActionTest two things malfunction.
  • 1. It is not possible to change the font of existing or new text; setting text as Bold has no effect either.

    2. Text that is Italic shows properly in the text editor and print preview but prints out as normal rather than italics.
Both of these issues exist only in WINE, things function correctly in Windows. The issues have been around since at least WINE 1.1.xx and Kubuntu 8.04. Is it something that needs fixing in ActionTest/TRichView or in WINE?

Thanks.
therapon
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Sorry, I am afraid that I do not know how to fix it from TRichView side.
It uses Canvas.Font and WinAPI functions.
therapon
Posts: 8
Joined: Thu Jan 19, 2012 1:55 pm

Post by therapon »

OK. Guess we'll have to see what the code gurus over at WINE can do. Thanks.
therapon
Posts: 8
Joined: Thu Jan 19, 2012 1:55 pm

Post by therapon »

Here's what I got for a response over at the WINE bug forum:
The problem is that RichView class (that the application is using internally)
decides to use font "times new roman" with charset 128 (SHIFTJIS_CHARSET) for
unicode text, and Wine chooses some random, i.e. "appropriate" font from an
underlying system which contains glyphs from that charset, but unfortunately
most (if not all) such fonts don't have a bold/italic faces.

If I hack dlls/gdi32/freetype.c,freetype_SelectFont() to ignore 128 charset,
then I can change text to bold, italic and so on, because now real Times New
Roman font is used, which supports them.

You may try to file a bug report to the creator(s) of RichView.
Does that make sense?
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

RichView applies Charset specified by the user in TextStyle.Charset.
You can modify your document and change charset of text styles to DEFAULT_CHARSET.

(TRichView cannot just ignore charset of TextStyles even for Unicode font. As far as I know, one value of charset is important - SYMBOL_CHARSET)
therapon
Posts: 8
Joined: Thu Jan 19, 2012 1:55 pm

Post by therapon »

Using the ActionTest demo from the download page, how do I change the charset? I guess the question also applies when using the RichView class within another application, too.

therapon
therapon
Posts: 8
Joined: Thu Jan 19, 2012 1:55 pm

Post by therapon »

Could you check the file at this link on the WINE forum and see if the DEFAULT_CHARSET is properly set?

http://bugs.winehq.org/attachment.cgi?id=38480

Could you also verify that the WinAPI functions are getting called with the correct parameters? e.g., with DEFAULT_CHARSET and not SHIFTJIS_CHARSET.

Thanks so much.

therapon
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Yes, this text uses SHIFTJIS_CHARSET.
And the same problem happens to it in Windows (at least in my version of WinXP where Times New Roman does not have Japanese characters): when I load this text in ActionTest demo, it is displayed using another font, not Times New Roman!
I selected all text, opened "Font | Font... (Advanced)", chose Script="(Default)", applied. Now all text is displayed in Times New Roman.
therapon
Posts: 8
Joined: Thu Jan 19, 2012 1:55 pm

Post by therapon »

Thanks for the help on charset. I was able to do as you said and it worked.

Do you have ideas on the second issue? Printing italics?
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Sorry, no
therapon
Posts: 8
Joined: Thu Jan 19, 2012 1:55 pm

Post by therapon »

Figured it out. I looked at the rvf file generated with unicode and then tracked it back from there. Apparently TRichView and whatever other libraries it uses don't know how to handle printing italic type when there's no italic ttf to go with the font. I was using Tahoma font, there's no "standard" italic form of the font like there is for Arial, Verdana, etc. (e.g. ariali.ttf, verdanai.ttf). As long as the ttf for italic text exists, TRichView can handle printing it ok in WINE.
therapon
Posts: 8
Joined: Thu Jan 19, 2012 1:55 pm

Post by therapon »

OK, on further investigation maybe there's a better way to look at it.

If an italic style font actually exists (ariali.ttf, for example) that name gets assigned in TRichView. It then prints correctly whether in WinXP or WINE.

If there's no italic style font (as is standard for Tahoma) then TRichView uses the base font and assigns the italic style to it. That works fine for printing in WinXP; it doesn't work in WINE. At this point, I assume it is a WINE problem, somewhere in the stuff that handles printing that doesn't recognize the style flag.
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

TRichView just sets Canvas.Font.Style, which in its order calls WinAPI's CreateFontIndirect (or, if TextStyle's CharScale<>100, then TRichView uses CreateFontIndirect directly). In the both cases, LogFont's quality and precision are set to defaults.

Specifics like using synthesized italic or not is implemented by OS, as I understand.
Post Reply