Project

General

Profile

Bug #2765

find proper freely licensed replacements for the MS Windows OS fonts

Added by Greg Shah over 8 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:

asap_regular_swing_20170420.jpg - Asap-Regular in Swing (22.2 KB) Eugenie Lyzenko, 04/20/2017 09:56 PM

asap_regular_web_20170420.jpg - Asap-Regular in Web (25.2 KB) Eugenie Lyzenko, 04/20/2017 09:57 PM

liberation_sans_regular_swing_20170425.jpg - Liberation Sans Regular in Swing hotel (98.8 KB) Eugenie Lyzenko, 04/25/2017 09:24 AM

liberation_sans_regular_web_20170425.jpg - Liberation Sans Regular in Web hotel (117 KB) Eugenie Lyzenko, 04/25/2017 09:24 AM

wine_tahoma_bold_swing_20170425.jpg - Wine Tahoma Bold swing sample (104 KB) Eugenie Lyzenko, 04/25/2017 08:53 PM

wine_vs_ms_tahoma_bold_comparisons_char_at.jpg - MS vs Wine tahoma comparison (179 KB) Eugenie Lyzenko, 04/26/2017 08:58 AM

fixedsys_excelsior_3.01_l2_info_20170426.jpg - Fixedsys Escelsior font info (191 KB) Eugenie Lyzenko, 04/26/2017 12:25 PM

dejavu_sans_bold_swing_20170426.jpg - DejaVu sans bold is swing client (18.8 KB) Eugenie Lyzenko, 04/26/2017 05:05 PM

fixedsys_gpl11_20170426.jpg - FixedsysTTF in swing client (15.7 KB) Eugenie Lyzenko, 04/26/2017 06:36 PM

fixedsys_gpl_5.0_info_20170426.jpg - FixedsysTTF font info (172 KB) Eugenie Lyzenko, 04/26/2017 06:37 PM

new_hotel_text_metrics_20170428a.zip - New text-metrics file (67.1 KB) Eugenie Lyzenko, 04/28/2017 11:39 AM

new_fonts_metrics_swing_20170428a.jpg - New login page (197 KB) Eugenie Lyzenko, 04/28/2017 11:41 AM

new_fonts_metrics_swing_20170428b.jpg - New initial page (95 KB) Eugenie Lyzenko, 04/28/2017 11:41 AM

new_vs_old_metrics_comparison_20170428.zip - Metrics compare results (163 KB) Eugenie Lyzenko, 04/28/2017 01:30 PM

new_fonts_metrics_web_classic_20170428a.jpg - New fonts web client login, classic theme (252 KB) Eugenie Lyzenko, 04/28/2017 01:30 PM

new_fonts_metrics_web_classic_20170428b.jpg - New fonts web client main page, classic theme (127 KB) Eugenie Lyzenko, 04/28/2017 01:31 PM

get_text_metrics.c_20170428a.zip - C version of text metrics capture (2.46 KB) Eugenie Lyzenko, 04/28/2017 10:09 PM

ms_sserif_swing_20170504.jpg - Old font name (197 KB) Eugenie Lyzenko, 05/04/2017 07:29 PM

liberation_sans_swing_20170504.jpg - New font name (197 KB) Eugenie Lyzenko, 05/04/2017 07:29 PM

no_fonts_swing_20170505.jpg - No fonts defined (197 KB) Eugenie Lyzenko, 05/05/2017 11:02 PM

new_fonts_old_metrics_swing_20170508a.jpg - New fornts, old metrics login (197 KB) Eugenie Lyzenko, 05/08/2017 10:58 AM

new_fonts_old_metrics_swing_20170508b.jpg - New fornts, old metrics main (78 KB) Eugenie Lyzenko, 05/08/2017 10:59 AM

ls_regular_swing_new_text-metrics_20170508a.jpg - New fonts, new metrics login (16 KB) Eugenie Lyzenko, 05/08/2017 10:59 AM

lato_regular_swing_20170508a.jpg - Lato Regular Swing login (25.5 KB) Eugenie Lyzenko, 05/08/2017 11:22 PM

lato_regular_swing_20170508b.jpg - Lato Regular Swing main (77.3 KB) Eugenie Lyzenko, 05/08/2017 11:23 PM

lato_regular_web_20170508a.jpg - Lato Regular web login (250 KB) Eugenie Lyzenko, 05/08/2017 11:23 PM

lato_regular_web_rates_20170509a.jpg - Lato Regular Web Rates page (170 KB) Eugenie Lyzenko, 05/09/2017 08:22 AM

lato_regular_swing_rates_20170509a.jpg - Lato Regular Swing Rates page (146 KB) Eugenie Lyzenko, 05/09/2017 08:22 AM

lato_regular_swing_login_aa-on_20170509a.jpg - AA is ON login (196 KB) Eugenie Lyzenko, 05/09/2017 09:15 AM

lato_regular_swing_main_aa-on_20170509b.jpg - AA is ON main (77.3 KB) Eugenie Lyzenko, 05/09/2017 09:15 AM

lato_regular_swing_login_aa-gasp_20170509a.jpg - AA is GASP login (196 KB) Eugenie Lyzenko, 05/09/2017 09:16 AM

lato_regular_swing_main_aa-gasp_20170509b.jpg - AA is GASP main (76.4 KB) Eugenie Lyzenko, 05/09/2017 09:16 AM

lato_regular_swing_login_aa-lcd-hrgb_20170509a.jpg - AA is LCD_HRGB login (196 KB) Eugenie Lyzenko, 05/09/2017 09:16 AM

lato_regular_swing_main_aa-lcd-hrgb_20170509b.jpg - AA is LCD_HRGB main (76.3 KB) Eugenie Lyzenko, 05/09/2017 09:17 AM

new_fonts_classic_swing_login_aa-on_20170509a.jpg - New fonts classic theme login (220 KB) Eugenie Lyzenko, 05/09/2017 08:48 PM

new_fonts_classic_swing_reservation_aa-on_20170509b.jpg - New fonts classic theme reservation page (146 KB) Eugenie Lyzenko, 05/09/2017 08:49 PM

DejaVuSans_license.txt Magnifier - DejaVu font license (8.61 KB) Eugenie Lyzenko, 05/10/2017 11:03 AM

system_as_default_swing_linux_20170519a.jpg - System font sample Linux (116 KB) Eugenie Lyzenko, 05/19/2017 12:57 PM

system_as_default_swing_windows_20170519a.jpg - System font sample Windows (118 KB) Eugenie Lyzenko, 05/19/2017 12:57 PM

system_font_windowsXP_20170519a.jpg - System font XP (12.8 KB) Eugenie Lyzenko, 05/19/2017 02:58 PM

system_font_windows7_20170519a.jpg - System font W7 (11.1 KB) Eugenie Lyzenko, 05/19/2017 02:58 PM

dejavu_as_system_swing_linux_20170519a.jpg - DejaVu Sans bold 10 as System font (21.5 KB) Eugenie Lyzenko, 05/19/2017 09:23 PM

default_alias_swing_linux_20170520a.jpg - Default Win10 (91.6 KB) Eugenie Lyzenko, 05/20/2017 01:35 PM

default_alias_swing_linux_20170520b.jpg - Default Classic (98.2 KB) Eugenie Lyzenko, 05/20/2017 01:35 PM

default-mono_alias_swing_linux_20170520b.jpg - Default Mono Classic (99.8 KB) Eugenie Lyzenko, 05/20/2017 01:36 PM

default-mono_alias_swing_linux_20170520a.jpg - Default Mono Win10 (94 KB) Eugenie Lyzenko, 05/20/2017 01:36 PM


Related issues

Related to User Interface - Feature #1794: implement font support Closed
Related to User Interface - Bug #2701: default font text sizing issue Closed

History

#1 Updated by Greg Shah over 8 years ago

Details on the original implementation are in #1794.

Improvements in the default font environment were done in #2701. For details on the licensing problem that has to be solved, please see #2701-7 (through 11)

#2 Updated by Greg Shah over 8 years ago

To be clear, there are 2 things going on here:

1. We are temporarily using the non-bitmap Windows fonts in our testing environments. We need to replace that usage with fonts that are a very close match in font/text metrics.

2. The bitmap fonts don't have any good equivalents today. This is believed to be the primary cause of our remaining layout/sizing differences.

Constantin: have I mis-stated this?

#3 Updated by Greg Shah over 8 years ago

-------- Forwarded Message --------
Subject: Re: Font rendering
Date: Tue, 8 Dec 2015 17:08:32 +0000
From: Guy ...
To: Greg Shah

Hi Greg,

Just found this:

http://stackoverflow.com/questions/12788789/metro-like-font-for-website-use

Webly Sleek by Mat Douglas is a very good approximation to Segoe UI. Looks like it's been used quite a lot.

Can't find much about said Mat Douglas or the source of the font, so I hope it's Kosher, and not just Segoe UI rebranded...

Regards,
Guy​

#4 Updated by Greg Shah over 8 years ago

GPL is listed on some sites as the license, but it is not clear what the source of that is from. It also is not clear what GPL means for a font. I agree that Webly Sleek does look like a nice font.

http://graphicdesign.stackexchange.com/questions/53234/webfont-alternative-to-segoe-ui

#5 Updated by Greg Shah about 8 years ago

  • Target version changed from Milestone 12 to Milestone 16
  • Assignee changed from Constantin Asofiei to Eugenie Lyzenko

#6 Updated by Greg Shah over 7 years ago

  • Target version changed from Milestone 16 to Cleanup and Stabilization for GUI

#7 Updated by Eugenie Lyzenko almost 7 years ago

The questions I have during background investigation.

1. The goal is to find fonts(currently vector based) that are free to distribute with FWD project, correct?

2. What about bitmap font? Do we have the plans to use them in project? If yes - do we need to find free replacement for MS bitmap fonts?

3. The fonts set we use are under server/fonts directory:

courbd.ttf  fsex301-l2.ttf  segoeuib.ttf  tahomabd.ttf
cour.ttf    micross.ttf     segoeui.ttf   tahoma.ttf

The goal is to find the fonts that best fit the list above(in metrics term), correct?

4. What are the criteria for font to be considered as 100% free? Are there such conditions? What about if the font author decides at some time font he developed will no longer be free. Is it possible case? Will it be an issue for us?

#8 Updated by Greg Shah almost 7 years ago

1. The goal is to find fonts(currently vector based) that are free to distribute with FWD project, correct?

Yes.

Or if the license doesn't allow inclusion in FWD directly, we would want to find a set of fonts that can be freely used by all of our customers. We could then automate the download of those fonts into an installation so that we always have a good set of fonts.

2. What about bitmap font? Do we have the plans to use them in project?

Not directly. We are not planning to implement bitmap font support at this time because it would require writing a bitmap font rendering engine for Java.

If yes - do we need to find free replacement for MS bitmap fonts?

Yes, we do need a free replacement. But the replacement cannot be a set of bitmap fonts. The replacement should be freely licensed vector fonts that closely match the look and metrics of the MS bitmap fonts.

The goal is to find the fonts that best fit the list above(in metrics term), correct?

Yes.

What are the criteria for font to be considered as 100% free? Are there such conditions? What about if the font author decides at some time font he developed will no longer be free. Is it possible case? Will it be an issue for us?

It will depend on the license provided. Usually, once a font is released under a given license, it cannot be removed from public use. So if you can find the right fonts and they are licensed properly, then we are OK.

I will make the final call on the license.

#9 Updated by Eugenie Lyzenko almost 7 years ago

Can we use the fonts under Apache License, Version 2.0 ?

#10 Updated by Eugenie Lyzenko almost 7 years ago

The web searching for fonts can be used with FWD project discovered some interesting resources:
1. https://en.wikipedia.org/wiki/Open-source_Unicode_typefaces - The summary of different free Unicode fonts available.
2. http://software.sil.org - the SIL International company that designs the free fonts.
3. https://fonts.google.com - the large repository of the fonts to download and use. Some of them under Apache License, Version 2.0 , while other - under Open Font License

I guess the best storage to try out is Google font if the license is acceptable for us to use. We can see the font preview, select candidates, download and use some technique to compare selected font with one we consider as "baseline" from the currently used set. For example we could write the Java program that checks the critical(or all) font properties, compares and makes conclusion if the font match or not. The other approach can use some 4gl converted sample with current font and new one to visually compare the results. The issue is when we need 100% match, for example if the deviation will be measured even by 1 pixel - we potentially can have layout issues or text distortions with the current application. This point needs clear and exact criteria of the font matching.

#11 Updated by Greg Shah almost 7 years ago

Can we use the fonts under Apache License, Version 2.0 ?

Yes.

#12 Updated by Greg Shah almost 7 years ago

while other - under Open Font License

This license is also acceptable. The only extra condition here is that we would have to include the OFL license in a text file along with the fonts (e.g. license.txt).

I guess the best storage to try out is Google font if the license is acceptable for us to use.

Yes, go ahead.

We can see the font preview, select candidates, download and use some technique to compare selected font with one we consider as "baseline" from the currently used set. For example we could write the Java program that checks the critical(or all) font properties, compares and makes conclusion if the font match or not. The other approach can use some 4gl converted sample with current font and new one to visually compare the results.

Both methods should be used.

Also, please do this 3rd test: calculate the text-metrics.xml values from these fonts and compare with those captured on Windows.

#13 Updated by Eugenie Lyzenko almost 7 years ago

The preliminary casting for font is in progress. The candidates:

ABeeZee-Regular.ttf       Carme-Regular.ttf
Actor-Regular.ttf         Chathura-Regular.ttf
AdventPro-Regular.ttf     DidactGothic-Regular.ttf
Aldrich-Regular.ttf       Heebo-Regular.ttf
AlegreyaSans-Regular.ttf  NTR-Regular.ttf
Allerta-Regular.ttf       PT_Sans-Narrow-Web-Regular.ttf
Asap-Regular.ttf          PT_Sans-Web-Regular.ttf
Assistant-Regular.ttf     Puritan-Regular.ttf
Cambay-Regular.ttf        Shanti-Regular.ttf

For now about 25% completed. The picture is not as good as for MS Sans Serif, for example Asap-Regular.ttf. You can see the distortions for Swing client. And this is the best example.

Swing:
Asap-Regular in Swing

Web:
Asap-Regular in Web

Continue working.

#14 Updated by Eugenie Lyzenko almost 7 years ago

The fonts from the list that are not acceptable as Sans-Serif family substitution:

AdventPro-Regular
Aldrich-Regular
AlegreyaSans-Regular
Allerta-Regular
Asap-Regular
Cambay-Regular
Chathura-Regular
Heebo-Regular
PT_Sans-Narrow-Web-Regular
Puritan-Regular
Puritan-Regular

The other are possible candidate more or less acceptable from visual point of view.

The point I want to understand now is what makes the MS Sans Serif(micross.ttf) so special in best looking with FWD. No other font I have tested at this time did show the comparable good results. There must be a reason. If we understand it - this helps to find the best substitution. Unfortunately FontForge application in Ubuntu is too old and traps too often. But we can use the Windows counterpart to compare fonts for example. Continue working.

#15 Updated by Eugenie Lyzenko almost 7 years ago

  • File liberation_sans_regular_web_20170424.jpg added
  • File liberation_sans_regular_swing_20170424.jpg added

Looks like I have found the good replacement for MS Sans Serif font(micross.ttf). It is LiberationSans-Regular.ttf. It looks much better than Sans family fonts available on Google font storage. The license:
This Font Software is licensed under the SIL Open Font License, Version 1.1:(http://scripts.sil.org/OFL).

Yes, it is included in Ubuntu but designed by Red Hat:
https://www.fontsquirrel.com/fonts/liberation-sans

Correct me if I'm wrong but I think it is free to use. Are there any reasons we have not used this font before?

The Swing and Web client pictures:

#16 Updated by Greg Shah almost 7 years ago

  • File deleted (liberation_sans_regular_swing_20170424.jpg)

#17 Updated by Greg Shah almost 7 years ago

  • File deleted (liberation_sans_regular_web_20170424.jpg)

#18 Updated by Greg Shah almost 7 years ago

Correct me if I'm wrong but I think it is free to use.

Yes, the SIL OFL is an acceptable license that makes these fonts free to use. We will have to include the license as a text file with the font(s).

Are there any reasons we have not used this font before?

This task is intended to find the right substitutes for the MS fonts. We just had not done the work yet to know which fonts are the best match.

#19 Updated by Eugenie Lyzenko almost 7 years ago

New LiberationSans-Regular font usage pictures for

Swing:
Liberation Sans Regular in Swing hotel

and Web:
Liberation Sans Regular in Web hotel

clients

#20 Updated by Eugenie Lyzenko almost 7 years ago

I need some assistance for turning on the old Windows "Classic theme". This will be helpful to find out the Tahoma font replacement. I have modified directory adding:

...
        <node class="string" name="theme/name">
          <node-attribute name="value" value="ClassicTheme"/>
        </node>
...

On the same level as
        <node class="container" name="custom-fonts">

container.

But the theme remains Windows 10. What did I wrong? I need classic theme for both swing and web clients. So the changing the client.sh is not enough(not working in Swing client).

#21 Updated by Eugenie Lyzenko almost 7 years ago

OK. The correct entry is:

...
        <node class="container" name="theme">
          <node class="string" name="name">
            <node-attribute name="value" value="ClassicTheme"/>
          </node>
        </node>
...

On the same level as:

...
        <node class="container" name="custom-fonts">
...

or
...
        <node class="container" name="font-table">
...

Thanks for help.

#22 Updated by Eugenie Lyzenko almost 7 years ago

New question for font replacement. I'm looking for MS Tahoma font. Another example of good looking font.

I have found there is so called Wine Tahoma Regular and Wine Tahoma Bold. The fonts can be found here:
https://www.rpmfind.net/linux/rpm2html/search.php?query=wine-tahoma-fonts
The filenames are: tahoma.ttf and tahomabd.ttf(the as MS ones). The License is LGPL:
https://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License

Is it acceptable to use this License policy type? Can we use the Tahoma package from Wine?

Take a look at the Window title. It uses Wine Tahoma Bold and perfectly match the original Tahoma.
Wine Tahoma Bold swing sample

It will be good to use because the metrics of the Wine fonts are the same as fonts we currently use.

#23 Updated by Eugenie Lyzenko almost 7 years ago

Good candidates for Fixedsys font(fonts/fsex301-l2.ttf):

ShareTechMono-Regular.ttf
VT323-Regular.ttf

The first one is better looking but the second is more like came from raster terminal based.

#24 Updated by Greg Shah almost 7 years ago

The LGPL is OK as a license.

Is the Wine Tahoma actually a different font from the MS Tahoma? I just want to make sure it is something that someone build separate from Microsoft (not copied).

#25 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

Is the Wine Tahoma actually a different font from the MS Tahoma? I just want to make sure it is something that someone build separate from Microsoft (not copied).

The Wine Tahoma is completely different font internally. Take a look at font comparison results(on the left picture - the combination of the glyphs from two fonts):
MS vs Wine tahoma comparison

The internal font name is different(WineTahomaBold), the glyphs are different, even the file sizes are different. The only the same are the font file name and metrics(I guess). Perfect candidate for replacement. I think we can even rename the font files to something like tahoma(bd)_wine.ttf to avoid any confusions.

#26 Updated by Greg Shah almost 7 years ago

Very good. The Wine Tahoma fonts are acceptable.

I think we can even rename the font files to something like tahoma(bd)_wine.ttf to avoid any confusions.

Good idea. Please don't include the ( and ) characters. For example, wine_tahoma_bold.ttf would be a good name.

#27 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

Good idea. Please don't include the ( and ) characters. For example, wine_tahoma_bold.ttf would be a good name.

OK.

Need to clarify the status of the currently used Fixedsys Excelsior font fonts/fsex301-l2.ttf. As far as I understand it is true type font simulating raster font MS Fixedsys. Take a look please at the font info integrated with file:
Fixedsys Escelsior font info

So it is third-party created font, not owned by Microsoft. It is not clear what the copyright is, nor what is the License type. Do you have any info about this? Can we just use(and distribute with FWD) this font freely? What do you think?

The considered candidates(ShareTechMono-Regular and VT323-Regular) do not fit. Moreover I think to find the proper counterpart we need to have the font that created with the same idea in mind - simulating raster font with TrueType. Or even in worse case we will have to create such font in GCD based on existed fsex301-l2.ttf file. Anyway for now I continue to find the replacement on the Web.

#28 Updated by Greg Shah almost 7 years ago

FixedSys Excelsior is probably fine to use, but because there is no explicit license the status is too ambiguous.

From http://www.fixedsysexcelsior.com/information/faq.htm:

Q: I use this font a lot. Am I expected to give you money?
A: No, Fixedsys Excelsior is free. If you feel incredibly grateful, send me an email or a letter or something else, maybe rose-flavored Turkish Delight (my address is at the bottom). Other flavors are fine too but rose is my favorite. And I am generally more concerned with music than fonts, so if you have any of that stuff ... Also, if you use IRC, feel free to proselytize to your friends. My real intention, if I have one at all, is to make IRC a more natural world without removing its distinctive feeling. Sure, maybe you don’t speak Farsi, but next time you encounter someone who does, they’ll be typing in Arabic, not question marks or boxes. The ultimate form of this dream would be to have Fixedsys Excelsior distributed with mIRC or other IRC clients.

This is not enough for us to prove it is safe. For that reason, we will not use Fixedsys Excelsior.

#29 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

FixedSys Excelsior is probably fine to use, but because there is no explicit license the status is too ambiguous.

From http://www.fixedsysexcelsior.com/information/faq.htm:

[...]

This is not enough for us to prove it is safe. For that reason, we will not use Fixedsys Excelsior.

Agreed.

#30 Updated by Eugenie Lyzenko almost 7 years ago

Found another good candidate for Fixedsys Excelsior substitution - DejaVuSans-Bold.ttf. The picture for font size 8, replaced as default font:
DejaVu sans bold is swing client

The origin is some Gnome related development. The license is:
https://dejavu-fonts.github.io/License.html

Is it acceptable for us?

#31 Updated by Greg Shah almost 7 years ago

The origin is some Gnome related development. The license is:
https://dejavu-fonts.github.io/License.html

Yes, this is acceptable. As with the other cases, we will have to include the license as a text file.

#32 Updated by Eugenie Lyzenko almost 7 years ago

Another fixedsys font:
http://host-a.net/u/mrbubl3s/fixedsys.ttf
The origin is pretty unknown, I think it is a kind of selfmade file. The picture for the size 11 is:
FixedsysTTF in swing client

The license info from file:
FixedsysTTF font info

I must say the font is exactly the same as Fixedsys Excelsior with size 12. So the question is the same - can we use it and distribute?

#33 Updated by Greg Shah almost 7 years ago

I must say the font is exactly the same as Fixedsys Excelsior with size 12. So the question is the same - can we use it and distribute?

Do you mean that this is a copy of Fixedsys Excelsior?

#34 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

Do you mean that this is a copy of Fixedsys Excelsior?

No. This is not a copy of Fixedsys Excelsior. I just can not exactly identify who made it. But it is completely different file, made with same idea in mind(TTF from raster).

#35 Updated by Greg Shah almost 7 years ago

I just can not exactly identify who made it.

To be safe, I think we need to avoid using it.

#36 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

To be safe, I think we need to avoid using it.

OK. In this case the best fonts are: LiberationSans or LiberationSansNarrow. The first is a bit wider than expected for micross.ttf ideal substitution.

Need some clarification for text-metrics.xml related testing. For new fonts to be properly used we need to remake the text-metrics.xml deployed with hotel_gui or any other converted application, right? Because even if the new fonts look similar there can be deviations that cause the current picture to have distortions.

So the approach is to:
1. Take all text strings that uses inside some project(hotel demo for example)
2. Use the java program to generate text metrics for the string list.

How do we generate text-metrics.xml for hotel GUI application? I think it is not manual, do I need to set up some tool?

Speaking about comparison to metrics generated in Windows you mean we need to use new font candidates or old font set(MS Sans Serif, Courier New, Tahoma, ...)?

#37 Updated by Constantin Asofiei almost 7 years ago

Eugenie Lyzenko wrote:

Need some clarification for text-metrics.xml related testing. For new fonts to be properly used we need to remake the text-metrics.xml deployed with hotel_gui or any other converted application, right? Because even if the new fonts look similar there can be deviations that cause the current picture to have distortions.

I would suggest something different. Build a large set of texts (which use i.e. M, W, m, i, |, narrow, wide, space, special character, etc - as many combinations and text lengths you find reasonable) - and capture text metrics with both the original Microsoft fonts and their associated replacement, with various font size (best would be from 1 to 99), bold, underline and italic combinations.

This way, you can have a 'side-by-side' metric comparison, and you will be able to find differences. You can use the existing get-text-metrics.p program - but this will require to install the replacement fonts on windev01, I think. After you have the text-metrics.xml with the Microsoft and replacement values, build a script or a small Java program to automate the comparison of the metrics.

#38 Updated by Eugenie Lyzenko almost 7 years ago

Constantin Asofiei wrote:

Eugenie Lyzenko wrote:

Need some clarification for text-metrics.xml related testing. For new fonts to be properly used we need to remake the text-metrics.xml deployed with hotel_gui or any other converted application, right? Because even if the new fonts look similar there can be deviations that cause the current picture to have distortions.

I would suggest something different. Build a large set of texts (which use i.e. M, W, m, i, |, narrow, wide, space, special character, etc - as many combinations and text lengths you find reasonable) - and capture text metrics with both the original Microsoft fonts and their associated replacement, with various font size (best would be from 1 to 99), bold, underline and italic combinations.

Is there any automation toll to generate text-metrics.xml file for hotel application? Was it performed with get-text-metrics.p for known text strings? If so how the string list was produced from source code?

#39 Updated by Eugenie Lyzenko almost 7 years ago

Constantin Asofiei wrote:

I would suggest something different. Build a large set of texts (which use i.e. M, W, m, i, |, narrow, wide, space, special character, etc - as many combinations and text lengths you find reasonable) - and capture text metrics with both the original Microsoft fonts and their associated replacement, with various font size (best would be from 1 to 99), bold, underline and italic combinations.

This way, you can have a 'side-by-side' metric comparison, and you will be able to find differences. You can use the existing get-text-metrics.p program - but this will require to install the replacement fonts on windev01, I think. After you have the text-metrics.xml with the Microsoft and replacement values, build a script or a small Java program to automate the comparison of the metrics.

Yes, this is a good approach to determine if the chosen new font is a "complete" replacement for the currently used font.

But what if we:
1. Do not find the exact replacement for old font or
2. Want to use another font we found as better one

In these cases we need a way to plug in new font(possibly with different metrics) into existed FWD code keeping UI look as good as before. Is it possible? I'm trying to understand if there is a fast way to make the list of the text strings to build the new text-metrics.xml file for either initial 4GL source tree or converted Java code. How we did this for hotel GUI application for example? Manually looking for source files?

#40 Updated by Eugenie Lyzenko almost 7 years ago

Another point to discuss.

What about this idea:
1. Every string is a cumulative combination of sequential characters, right?
2. We can compute the metrics for all characters we can use. It is big(up to 65536 in Unicode range) but not infinite, correct?
3. To have the metrics for arbitrary string we can sum the metrics of all single chars included into the given string.

This way we can make single metrics data file captured once per font change and do not need to make a list of all strings used in particular converted application.

#41 Updated by Constantin Asofiei almost 7 years ago

Eugenie Lyzenko wrote:

Is there any automation toll to generate text-metrics.xml file for hotel application? Was it performed with get-text-metrics.p for known text strings?

Yes, get-text-metrics.p was use.d

If so how the string list was produced from source code?

The strings are collected during conversion and saved in ui_strings.txt - this file is used by get-text-metrics.p.

#42 Updated by Constantin Asofiei almost 7 years ago

Eugenie Lyzenko wrote:

But what if we:
1. Do not find the exact replacement for old font or
2. Want to use another font we found as better one

In these cases we need a way to plug in new font(possibly with different metrics) into existed FWD code keeping UI look as good as before. Is it possible? I'm trying to understand if there is a fast way to make the list of the text strings to build the new text-metrics.xml file for either initial 4GL source tree or converted Java code. How we did this for hotel GUI application for example? Manually looking for source files?

The idea in FWD is to use a "font alias" to map a font configured in the legacy font table (like MS Sans Serif) do a replacement font. This will override the font only at drawing - everything else, text metrics, font metrics, etc will use the legacy font.

The approach I've noted is for you to be able to confirm that the replacement font is compatible with the original; if the text metrics varies slightly, I think it will be OK.

If you want to test the replacement font in Hotel GUI app, follow these steps:
  1. register the replacement font in the custom-fonts section in the directory (like the 'legacy' fonts are registered).
  2. add a new font-aliases section (on the same level as custom-fonts) with details like this (just an example):
    <node class="container" name="font-aliases">
       <node class="string" name="default-font">
          <node-attribute name="value" value="Liberation Sans Regular, size=10"/>
       </node>
       <node class="string" name="default-fixed-font">
          <node-attribute name="value" value="DejaVu sans, size=8"/>
       </node>
       <node class="string" name="font0">
          <node-attribute name="value" value="DejaVu sans, size=10"/>
       </node>
       <node class="string" name="window-title-font">
          <node-attribute name="value" value="DejaVu sans, size=14"/>
       </node>
    </node>
    

    The structure is similar with the font-table section; but each key (like font0) must be a mapping into the existing font-table or the ID of a system font or default font.

#43 Updated by Constantin Asofiei almost 7 years ago

Eugenie Lyzenko wrote:

Another point to discuss.

What about this idea:
1. Every string is a cumulative combination of sequential characters, right?

Yes, but metrics are computed per the entire string - is not correct to assume that the width of the strings is the same as if you sum the individual widths for each character in the string.

2. We can compute the metrics for all characters we can use. It is big(up to 65536 in Unicode range) but not infinite, correct?

This can be done, but you will need a separate tool for it - get-text-metrics.p is pretty slow. But this doesn't mean you can't use single-char strings for the latin alphabet, for example.

3. To have the metrics for arbitrary string we can sum the metrics of all single chars included into the given string.

See above - this is not correct.

This way we can make single metrics data file captured once per font change and do not need to make a list of all strings used in particular converted application.

Again, the replacement fonts will be used only for drawing; the font metrics will for sure remain the legacy ones.

For the text metrics, if a dynamic text was not captured, the driver will go ahead and measure the text with the replacement font; but otherwise, it will default to the metrics computed with the original font.

So, first, please build a list of strings (in a simple text file) which cover various lenghts/characters and post it here.

After this, we can go ahead and capture the metrics and with the replacement and original fonts, and see how they behave.

BTW, if you have a Windows OS and can build a small C program which uses the same native APIs as get-text-metrics.p to measure the text, you can just:
  1. iterate over the strings in your text file
  2. measure with original font and replacement font (again, with font sizes, bold, italic, underline combinations) and output just the strings and fonts for which the metrics differ

I expect this to be a lot faster then the get-text-metrics.p program.

#44 Updated by Greg Shah almost 7 years ago

Eugenie: you can look inside get-text-metrics.p to see the native WIN32 APIs being called and how we are capturing the metrics. It would be useful to have a C version of that program. This would be slightly different from the version that captures all Unicode characters.

#45 Updated by Eugenie Lyzenko almost 7 years ago

Constantin Asofiei wrote:

If you want to test the replacement font in Hotel GUI app, follow these steps:
  1. register the replacement font in the custom-fonts section in the directory (like the 'legacy' fonts are registered).
  2. add a new font-aliases section (on the same level as custom-fonts) with details like this (just an example):
    [...]
    The structure is similar with the font-table section; but each key (like font0) must be a mapping into the existing font-table or the ID of a system font or default font.

Can the

        <node class="container" name="font-table">

and
        <node class="container" name="font-aliases">

co-exist in the directory.xml file?

Must the new fonts be an addition to already defined fonts in:

        <node class="container" name="custom-fonts">

taking the next positions like this:
          <node class="container" name="font10">
            <node class="string" name="font">
              <node-attribute name="value" value="WineTahoma"/>
            </node>
            <node class="string" name="file">
              <node-attribute name="value" value="fonts/wine_tahoma.ttf"/>
            </node>
          </node>

When testing new fonts looking I just replaced the file name keeping old font name like this:

          <node class="container" name="font9">
            <node class="string" name="font">
              <node-attribute name="value" value="MS Sans Serif"/>
            </node>
            <node class="string" name="file">
              <node-attribute name="value" value="fonts/LiberationSans-Regular.ttf"/>
            </node>
          </node>

So no font aliases are required to quick test.

#46 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

Eugenie: you can look inside get-text-metrics.p to see the native WIN32 APIs being called and how we are capturing the metrics. It would be useful to have a C version of that program. This would be slightly different from the version that captures all Unicode characters.

OK. Yes, having such C program we can use local Windows system to capture text metrics, no need to consume windev01 resources.

#47 Updated by Constantin Asofiei almost 7 years ago

Eugenie Lyzenko wrote:

Constantin Asofiei wrote:

If you want to test the replacement font in Hotel GUI app, follow these steps:
  1. register the replacement font in the custom-fonts section in the directory (like the 'legacy' fonts are registered).
  2. add a new font-aliases section (on the same level as custom-fonts) with details like this (just an example):
    [...]
    The structure is similar with the font-table section; but each key (like font0) must be a mapping into the existing font-table or the ID of a system font or default font.

Can the
[...]
and
[...]
co-exist in the directory.xml file?

Yes. font-aliases remaps a font ID from font-table to another font specification.

Must the new fonts be an addition to already defined fonts in:
[...]
taking the next positions like this:
[...]

Yes. Note that the font10 in custom-fonts node does not map to anything, is just an unique ID under the custom-fonts node.

When testing new fonts looking I just replaced the file name keeping old font name like this:
[...]
So no font aliases are required to quick test.

It is OK if it works for testing.

#48 Updated by Eugenie Lyzenko almost 7 years ago

This is the result of regeneration the text-metrics.xml file for font set:

Liberation Sans Narrow
Liberation Mono
Open Sans
Liberation Sans
DejaVu Sans Bold
Tahoma(Wine)

The swing client pictures:
New login page

As you can see after recalc the metrics the field labels look properly right-aligned(new font is a bit wider than original).

New initial page

The source text string list and new metrics file is attached.

Continue with comparison tool implementation.

#49 Updated by Eugenie Lyzenko almost 7 years ago

The attached archive containing 3 files:
text-metrics0.xml - metrics captured for hotel GUI application with fonts considering as substitution candidates
text-metrics1.xml - metrics captured for hotel GUI application with currently used fonts
text-metrics0vs1.xml - new font metrics with font names changed to old fonts(easy to do in jEdit)

All data captured on windev01.

So the diff tool(or KDiff GUI) can be used to find differences between new and old fonts for same font type/size options. And I must say there are the differences, most cases in 1-2 pixels but sometimes the difference is bigger.

What the conclusion will be? If we want to use new fonts within FWD - we will have to re-calc text-metrics.xml for GUI applications, like hotel GUI. What do you think, the fonts look pretty acceptable, here are the classic theme web client picture with new fonts for review:

New fonts web client login, classic theme

New fonts web client main page, classic theme

What do you think? Need to search another fonts to use?

#50 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

Eugenie: you can look inside get-text-metrics.p to see the native WIN32 APIs being called and how we are capturing the metrics. It would be useful to have a C version of that program. This would be slightly different from the version that captures all Unicode characters.

Another word we do not need the Unicode support for the C version of this program, correct?

#51 Updated by Greg Shah almost 7 years ago

The results seem pretty good. We can always work on it more later if needed, but this seems like a much better set of defaults than before.

Constantin: what do you think?

Another word we do not need the Unicode support for the C version of this program, correct?

I'll let Constantin make the call on that.

#52 Updated by Constantin Asofiei almost 7 years ago

Greg Shah wrote:

The results seem pretty good. We can always work on it more later if needed, but this seems like a much better set of defaults than before.

Constantin: what do you think?

Yes, I agree, the example looks good. Greg, a remark related to the metrics server: the text-metrics.xml and the metrics server both need to report these metrics for the legacy font (as configured in the legacy font-table), and not with the replacement font. One reason is that this legacy width is used for i.e. TEXT widget's implicit WIDTH computation. I hope this makes clear why I mentioned above that the replacement font is 'for drawing only'.

Another word we do not need the Unicode support for the C version of this program, correct?

I'll let Constantin make the call on that.

No, we don't need UNICODE support. I think printable ASCII chars would be enough, just ensure the tested strings have enough coverage. As you found above, a small found difference can be ignored (1 or 2 pixels) and report only cases where the differences are greater. Or you can build some stats and see the percentange of each difference over the entire set of metrics.

#53 Updated by Eugenie Lyzenko almost 7 years ago

The creation of the get_text_metrics.c is in progress. Here is a prototype as of this time. It reads the font file with name and size, reads the text list file and generates draft for final XML file. Hope to finish soon. Planning to have the same functionality as for *.p version of the program.

Not clear the place within FWD project to put this file. Also need to create special branch? The regression testing is not required so the standalone branch is not necessary too. Continue working with C implementation.

#54 Updated by Greg Shah almost 7 years ago

Not clear the place within FWD project to put this file.

This tool will be needed for all GUI projects, it makes sense to include it in src/native/ and the Windows-specific build.

In addition, for people that are going to implement FWD on Linux, it would be useful to be able to just build that one piece on Windows. Please also create a script that can compile it by itself.

Create a new branch for this.

#55 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

Not clear the place within FWD project to put this file.

This tool will be needed for all GUI projects, it makes sense to include it in src/native/ and the Windows-specific build.

In addition, for people that are going to implement FWD on Linux, it would be useful to be able to just build that one piece on Windows. Please also create a script that can compile it by itself.

Create a new branch for this.

OK. Created task branch 2765a from trunk revision 11150.

#56 Updated by Eugenie Lyzenko almost 7 years ago

Task branch 2765a for review updated to revision 11151.

The update include full-functional get_text_metrics utility. Tested to get and compare the output with one that we have from get-text-metrics.p. So no more need to use windev01 to capture the text metrics.

The font list format has been changed a bit. If required to explicitly set up some font option, just put in the options before space char " ", like this:

Font name,8,true, ,false

This will mean the italic value is undefined and be used both(true and false). The following line:
Font name,8,true,,false

is incorrect and does not work properly.

Continue working with integration of the get_text_metrics.c compiling into Windows target FWD build process.

#57 Updated by Eugenie Lyzenko almost 7 years ago

Task branch 2765a for review updated to revision 11152.

This is the integration of the get_text_metrics.exe building into Windows based FWD gradlew based compilation. Also minor changes for get_text_metrics.c to cleanups make warnings for -Wall option. The exe file is located at fwd\build\native target directory.

To use standalone build_ulits.cmd script the *.cmd and *.c source must be in the same directory, the compiled exe file is in the same directory too in this case.

#58 Updated by Greg Shah almost 7 years ago

Code Review Task Branch 2765a Revision 11152

The overall approach is very good. I did make some edits to the prompts (rev 11153) but I think the UI is fine.

1. How long does it take to calculate the results for a large customer application? It seems like the font that is created could be reused for the entire list of strings instead of recreating the font each time. This would seem to potentially be a faster implementation, but if the program is quick already then it doesn't matter. I realize this would be a big refactoring, so if it is not needed then we can avoid it.

2. I think the error handling in getMetrics() should look at the WIN32 return codes and provide more feedback.

3. The fw = fopen(xmlFileName, "wt"); (line 372) should check for failure before writing to that file.

#59 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

Code Review Task Branch 2765a Revision 11152

The overall approach is very good. I did make some edits to the prompts (rev 11153) but I think the UI is fine.

1. How long does it take to calculate the results for a large customer application? It seems like the font that is created could be reused for the entire list of strings instead of recreating the font each time. This would seem to potentially be a faster implementation, but if the program is quick already then it doesn't matter. I realize this would be a big refactoring, so if it is not needed then we can avoid it.

The format of the output text-metrics.xml should be the same as we currently have?

The only things we will have to do every time for every font are:
SelectObject() and GetTextExtentPoint()
All other WIN32 calls can be cached with more or less memory consumptions. We will have to create and keep the array of HFONT logical font objects with single HFONT for every font name, font size(possibly 1-MAX), bold, italic, underline. So single font will potentially consume MAX*8 array items giving for MAX==20 160 array items for every font considering.

Yes, we will have some performance gain in such optimization(especially for large text lines and large font list). I think it makes sense to do this optimization. I do not think it it too much work for refactoring.

Currently the execution time is 1-2 seconds in Windows VM for hotel GUI with 5 fonts and predefined font sizes(8 calls per every font).

#60 Updated by Greg Shah almost 7 years ago

The format of the output text-metrics.xml should be the same as we currently have?

Yes.

I think it makes sense to do this optimization. I do not think it it too much work for refactoring.

OK, go ahead.

#61 Updated by Eugenie Lyzenko almost 7 years ago

Task branch 2765a for review updated to revision 11154.

This is just a notes resolution for current version and minor change for size entering prompt, ; replaced with ,.

I made this commit to have the stable version before refactoring. Also I have got the output for current version to prevent regressions. Continue with refactoring itself.

#62 Updated by Eugenie Lyzenko almost 7 years ago

Task branch 2765a for review updated to revision 11155.

Refactored candidate for speed optimized approach. Tested with previously recorded metrics. Also I have fixed metrics recording for 0 font size, this is useless so the font is taking from 1-Max sizes. Need to add functions comments I guess, make more testing and possibly resolve the notes. But the main idea is here.

And I can tell it become faster than before, I can not estimate the speed, something less than 1 sec.

#63 Updated by Eugenie Lyzenko almost 7 years ago

The new C based program was tested on windev01 with large scale GUI app:
56516 lines of text
7 logical fonts used

The results are the same except string "?" where *.p gives incorrect 0 values for size.

The timing is following:
Progress based code: 17'40" = 1060 seconds to complete
C based executable: 2 seconds to complete
The speed gain is 530 times.

#64 Updated by Greg Shah almost 7 years ago

Nice results!

#65 Updated by Greg Shah almost 7 years ago

Code Review Task Branch 2765a Revision 11155

The changes look good.

Please do the code/doc cleanups.

#66 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

Code Review Task Branch 2765a Revision 11155

The changes look good.

Please do the code/doc cleanups.

OK. In progress.

The program has two restrictions for input data files to work with(not for the logical fonts created at runtime):
1. The maximum length of the text line in input file is 4096 of char data type units.
2. The maximum number of the fonts in font list input file is 16.

Please let me know if it is not enough, we can increase the values or make something dynamically allocated.

#67 Updated by Greg Shah almost 7 years ago

The text line length limit is probably fine.

I do think the number of fonts should be much larger (128?).

#68 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

The text line length limit is probably fine.

I do think the number of fonts should be much larger (128?).

Task branch 2765a for review updated to revision 11156.

Adding comments, code cleanups. The font list limit for font-list.txt file has been increased up to 256. Also added protection from exceeding this value to avoid array out of range failure. Also the user is warning about line length limitation. The xml text line has been also increased to have enough room for possible extreme lines with multiple XML special chars -> &xxxx; substitutions.

So I guess this is a candidate to be included into FWD trunk.

#69 Updated by Eugenie Lyzenko almost 7 years ago

The program does not work as expected in 32-bit Windows 7(I worked with 64-bit version before). Investigating the root cause.

#70 Updated by Eugenie Lyzenko almost 7 years ago

Task branch 2765a for review updated to revision 11157.

Added bug fix. The second parameter for strtok() function must be null terminated string, otherwise the 32-bit implementation is failing to work. Now confirm both 32-bit and 64-bit versions are working fine. Also added other minor improvements and bug fixing. And finally added missing font list file check, application does not start of no file.

So the application is in a good shape on my guess as release candidate.

#71 Updated by Eugenie Lyzenko almost 7 years ago

Tested in Windows XP 32-bit and 64-bit. Works fine in both systems.

#72 Updated by Greg Shah almost 7 years ago

Code Review Task Branch 2765a Revision 11157

I'm good with the changes.

Please make sure that the build process generates the same libp2j.so and spawner for both Windows and Linux. If so, then you can merge to trunk.

#73 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

Code Review Task Branch 2765a Revision 11157

I'm good with the changes.

Please make sure that the build process generates the same libp2j.so and spawner for both Windows and Linux. If so, then you can merge to trunk.

OK.

Then archive the 2765a branch, correct?

#74 Updated by Greg Shah almost 7 years ago

Yes.

#75 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

Code Review Task Branch 2765a Revision 11157

Please make sure that the build process generates the same libp2j.so and spawner for both Windows and Linux. If so, then you can merge to trunk.

It is OK. Starting to merge into trunk.

#76 Updated by Eugenie Lyzenko almost 7 years ago

Branch 2765a was merged to trunk as revno 11151 then it was archived.

#77 Updated by Eugenie Lyzenko almost 7 years ago

The next question I'm trying to resolve. It is strange but when I'm changing the old names with new ones for font related directory entries the picture of the hotel demo is significantly changes. For example, this is how the directory file was when I have changed the font files:

...
          <node class="container" name="font9">
            <node class="string" name="font">
              <node-attribute name="value" value="MS Sans Serif"/>
            </node>
            <node class="string" name="file">
              <node-attribute name="value" value="fonts/new/LiberationSans-Regular.ttf"/>
            </node>
          </node>
...
        <node class="container" name="font-table">
          <node class="string" name="default-font">
            <node-attribute name="value" value="MS Sans Serif, size=8"/>
          </node>
...

I thought this is enough to use new font instead of MS Sans Serif, meaning inside FWD the font is named as MS Sans Serif but actually the font is LiberationSans. Am I wrong? I saw the font changed when the file was changed from:

            <node class="string" name="file">
              <node-attribute name="value" value="fonts/micross.ttf"/>
            </node>

to:
            <node class="string" name="file">
              <node-attribute name="value" value="fonts/new/LiberationSans-Regular.ttf"/>
            </node>

Constantin, can you clarify this point? When FWD needs some font name it looks for the directory.xml, loads the file from custom-fonts and uses this font as if it has the name associated with font9 above? Is it correct understanding? If not why when I'm changing only the file name keeping the font name in directory.xml the GUI screen is changing?

#78 Updated by Eugenie Lyzenko almost 7 years ago

What I mean:

...
          <node class="container" name="font9">
            <node class="string" name="font">
              <node-attribute name="value" value="MS Sans Serif"/>
            </node>
            <node class="string" name="file">
              <node-attribute name="value" value="fonts/new/LiberationSans-Regular.ttf"/>
            </node>
          </node>
...
        <node class="container" name="font-table">
          <node class="string" name="default-font">
            <node-attribute name="value" value="MS Sans Serif, size=8"/>
          </node>
...

gives:
Old font name

While:

...
          <node class="container" name="font9">
            <node class="string" name="font">
              <node-attribute name="value" value="Liberation Sans"/>
            </node>
            <node class="string" name="file">
              <node-attribute name="value" value="fonts/new/LiberationSans-Regular.ttf"/>
            </node>
          </node>
...
        <node class="container" name="font-table">
          <node class="string" name="default-font">
            <node-attribute name="value" value="Liberation Sans, size=8"/>
          </node>
...

gives:
New font name

#79 Updated by Eugenie Lyzenko almost 7 years ago

Another points to clarify:

There are 2 themes currently supported: Classic and Windows10. Each theme has it's own hardcoded set of initial fonts to use. The question: what has preference in using either fonts defined in current theme or fonts defined in directory.xml? Do we need to get rid of the Microsoft based fonts in theme related java classes?

My plan is to check font candidates completely replacing font file and font names adjusting the size to have same picture for hotel GUI. So I need to know if the fonts hardcoded into (ClassicTheme|Windows10Theme).getStandardFontTable() have effect in runtime with fonts defined in directory.xml?

#80 Updated by Constantin Asofiei almost 7 years ago

Eugenie Lyzenko wrote:

What I mean:
[...]
gives:
Old font name

While:
[...]
gives:
New font name

OK, see note https://proj.goldencode.com/issues/2765#note-42 - this is the correct way to override a font, not by changing the font file. Also, the custom-fonts entry will be used only if the font is not installed - if is installed, then it will not be used.

#81 Updated by Constantin Asofiei almost 7 years ago

Eugenie Lyzenko wrote:

My plan is to check font candidates completely replacing font file and font names adjusting the size to have same picture for hotel GUI. So I need to know if the fonts hardcoded into (ClassicTheme|Windows10Theme).getStandardFontTable() have effect in runtime with fonts defined in directory.xml?

See https://proj.goldencode.com/issues/2765#note-42

#82 Updated by Eugenie Lyzenko almost 7 years ago

Constantin Asofiei wrote:

Eugenie Lyzenko wrote:

My plan is to check font candidates completely replacing font file and font names adjusting the size to have same picture for hotel GUI. So I need to know if the fonts hardcoded into (ClassicTheme|Windows10Theme).getStandardFontTable() have effect in runtime with fonts defined in directory.xml?

See https://proj.goldencode.com/issues/2765#note-42

1. I have registered new fonts with custom-fonts sections for numbers font10 - font18(in addition to already registered legacy ones):

        <node class="container" name="custom-fonts">
...
          <node class="container" name="font10">
            <node class="string" name="font">
              <node-attribute name="value" value="Wine Tahoma"/>
            </node>
            <node class="string" name="file">
              <node-attribute name="value" value="fonts/new/wine_tahoma.ttf"/>
            </node>
          </node>
...
          <node class="container" name="font18">
            <node class="string" name="font">
              <node-attribute name="value" value="Liberation Sans"/>
            </node>
            <node class="string" name="file">
              <node-attribute name="value" value="fonts/new/LiberationSans-Regular.ttf"/>
            </node>
          </node>
        </node>

Then added the font aliases:

...
        <node class="container" name="font-aliases">
          <node class="string" name="default-font">
            <node-attribute name="value" value="Liberation Sans, size=9"/>
          </node>
          <node class="string" name="default-fixed-font">
            <node-attribute name="value" value="Liberation Mono, size=10"/>
          </node>
          <node class="string" name="window-title-font">
            <node-attribute name="value" value="DejaVu Sans, size=14"/>
          </node>
        </node>
        <node class="container" name="font-table">
          <node class="string" name="default-font">
            <node-attribute name="value" value="MS Sans Serif, size=8"/>
          </node>
          <node class="string" name="default-fixed-font">
            <node-attribute name="value" value="Courier New, size=8"/>
          </node>
          <node class="string" name="font0">
            <node-attribute name="value" value="FixedSys"/>
          </node>
...

In this directory.xml config the hotel application uses the legacy fonts(MS Sans Serif, Courier New). What I'm doing wrong? Can the font-aliases and font-table sections co-exist? Or they are mutually exclusive?

Another question. The text-metrics.xml file must have the "legacy" fonts or replacements? Or both? It is not clear from https://proj.goldencode.com/issues/2765#note-42.

#83 Updated by Constantin Asofiei almost 7 years ago

Eugenie Lyzenko wrote:

Constantin Asofiei wrote:
In this directory.xml config the hotel application uses the legacy fonts(MS Sans Serif, Courier New). What I'm doing wrong? Can the font-aliases and font-table sections co-exist? Or they are mutually exclusive?

They can co-exist with no problem. The approach is this:
  1. the font name (for legacy purposes - i.e. resolving text metrics) is resolved from the font-table
  2. if the font ID from font-table (or any other system font id) exists in font-aliases, then that font will be used for drawing (and for computing metrics if there are no legacy metrics).

Another question. The text-metrics.xml file must have the "legacy" fonts or replacements? Or both? It is not clear from https://proj.goldencode.com/issues/2765#note-42.

text-metrics.xml must have the legacy font metrics, not the replacements. The metrics can co-exist, too, but when resolving them the font-table's font will be used (and not the replacement).

Is that your entire font-aliases section? Because is missing the replacements for the font-table fonts... (i.e. font0, font1, etc).

#84 Updated by Eugenie Lyzenko almost 7 years ago

Constantin Asofiei wrote:

Is that your entire font-aliases section? Because is missing the replacements for the font-table fonts... (i.e. font0, font1, etc).

OK. Now that was entire section. But now I have the following:

...
        <node class="container" name="font-aliases">
          <node class="string" name="default-font">
            <node-attribute name="value" value="Open Sans, size=9"/>
          </node>
          <node class="string" name="default-fixed-font">
            <node-attribute name="value" value="Liberation Mono, size=10"/>
          </node>
          <node class="string" name="window-title-font">
            <node-attribute name="value" value="DejaVu Sans, size=14"/>
          </node>
          <node class="string" name="font0">
            <node-attribute name="value" value="DejaVu Sans"/>
          </node>
          <node class="string" name="font1">
            <node-attribute name="value" value="System"/>
          </node>
          <node class="string" name="font2">
            <node-attribute name="value" value="Liberation Mono, size 8"/>
          </node>
          <node class="string" name="font3">
            <node-attribute name="value" value="Liberation Mono, size=8"/>
          </node>
          <node class="string" name="font4">
            <node-attribute name="value" value="Liberation Sans, size=8"/>
          </node>
          <node class="string" name="font5">
            <node-attribute name="value" value="Liberation Sans, size=10"/>
          </node>
          <node class="string" name="font6">
            <node-attribute name="value" value="Liberation Sans, size=8, bold"/>
          </node>
          <node class="string" name="font7">
            <node-attribute name="value" value="System"/>
          </node>
          <node class="string" name="font8">
            <node-attribute name="value" value="Liberation Sans, size=8"/>
          </node>
          <node class="string" name="font9">
            <node-attribute name="value" value="Liberation Sans, size 8"/>
          </node>
          <node class="string" name="font10">
            <node-attribute name="value" value="Liberation Sans, size 8"/>
          </node>
          <node class="string" name="font11">
            <node-attribute name="value" value="Liberation Sans, size 8"/>
          </node>
          <node class="string" name="font12">
            <node-attribute name="value" value="Liberation Mono, size 8"/>
          </node>
          <node class="string" name="font13">
            <node-attribute name="value" value="system"/>
          </node>
          <node class="string" name="font14">
            <node-attribute name="value" value="system"/>
          </node>
          <node class="string" name="font15">
            <node-attribute name="value" value="system"/>
          </node>
          <node class="string" name="font16">
            <node-attribute name="value" value="Liberation Mono, size=8"/>
          </node>
        </node>
        <node class="container" name="font-table">
          <node class="string" name="default-font">
            <node-attribute name="value" value="MS Sans Serif, size=8"/>
          </node>
          <node class="string" name="default-fixed-font">
            <node-attribute name="value" value="Courier New, size=8"/>
          </node>
          <node class="string" name="font0">
            <node-attribute name="value" value="FixedSys"/>
          </node>
          <node class="string" name="font1">
            <node-attribute name="value" value="System"/>
          </node>
          <node class="string" name="font2">
            <node-attribute name="value" value="Courier New, size 8"/>
          </node>
          <node class="string" name="font3">
            <node-attribute name="value" value="Courier New, size=8"/>
          </node>
          <node class="string" name="font4">
            <node-attribute name="value" value="Microsoft Sans Serif, size=8"/>
          </node>
          <node class="string" name="font5">
            <node-attribute name="value" value="Microsoft Sans Serif, size=10"/>
          </node>
          <node class="string" name="font6">
            <node-attribute name="value" value="Microsoft Sans Serif, size=8, bold"/>
          </node>
          <node class="string" name="font7">
            <node-attribute name="value" value="System"/>
          </node>
          <node class="string" name="font8">
            <node-attribute name="value" value="Microsoft Sans Serif, size=8"/>
          </node>
          <node class="string" name="font9">
            <node-attribute name="value" value="Microsoft Sans Serif, size 8"/>
          </node>
          <node class="string" name="font10">
            <node-attribute name="value" value="Microsoft Sans Serif, size 8"/>
          </node>
          <node class="string" name="font11">
            <node-attribute name="value" value="Microsoft Sans Serif, size 8"/>
          </node>
          <node class="string" name="font12">
            <node-attribute name="value" value="Courier New, size 8"/>
          </node>
          <node class="string" name="font13">
            <node-attribute name="value" value="system"/>
          </node>
          <node class="string" name="font14">
            <node-attribute name="value" value="system"/>
          </node>
          <node class="string" name="font15">
            <node-attribute name="value" value="system"/>
          </node>
          <node class="string" name="font16">
            <node-attribute name="value" value="Courier New, size=8"/>
          </node>
        </node>
...

But nothing is changed. The application does not use the replacement fonts(all of them defined in custom-fonts section). It is not clear why it does not work as expected.

So I would offer to following:
1. Edit custom-fonts section leaving only replacement fonts.
2. Edit font-table to replace legacy fonts with replaced.

I still do not understand if the font name in directory.xml is used somewhere outside (font name)<->(font file) association. I mean if the FWD takes the MS Sans Serif name from directory.xml and font file is LiberationSans-Regular.ttf for this font name - what font will really be used, Liberation Sans or micross.ttf?

If there are no short answers, I will have to debug FontManager to find out the way it goes.

#85 Updated by Eugenie Lyzenko almost 7 years ago

Another interesting picture:
No fonts defined

This is the result of removing legacy fonts from deploy/server/fonts directory. FWD is unable to load legacy fonts. However it does not use font-aliases definitions even in this case(the picture is not changing when changing the size of the font in font-aliases section). But some fonts are loading from system, so we need to understand the approach java is used to provide font for rendering.

If we need to get rid of licensed fonts dependence I guess we have to completely remove legacy font definitions from directory.xml file(and probably in theme definition java classes too). Then we set up the new fonts(type and size) for best match with legacy look and feel.

Another possible approach will be not to provide any fonts. The system always have some font set(Serif, Sans and Monospaced). We just need to select best fitted font family and size from existed set.

For the font replacement - I will test different sizes and prepare the free font set that can be used as alternative solution.

#86 Updated by Greg Shah almost 7 years ago

Most likely there is a problem with your directory.xml. Please send it to Constantin for review.

#87 Updated by Constantin Asofiei almost 7 years ago

Eugenie, please use this patch; there was a problem that font-aliases was being searched 'per-user', custom-fonts 'per-server' and font-table 'per-both'. I've fixed font-aliases and custom-fonts to be searched 'per-both'.

Index: src/com/goldencode/p2j/ui/FontTable.java
===================================================================
--- src/com/goldencode/p2j/ui/FontTable.java    (revision 1054)
+++ src/com/goldencode/p2j/ui/FontTable.java    (working copy)
@@ -37,6 +37,8 @@
 ** 017 VIG 20160410 Fixed ALERT_BOX_FONT and added system MENU_FONT.
 ** 018 SVL 20170126 Added SORT_NUMBER_FONT.
 ** 019 OM  20170329 Added support for Themes.
+** 020 CA  20170508 Fixed FONT_ALIASES and CUSTOM_FONTS search: is done both per server and 
+**                  account.
 */
 /*
 ** This program is free software: you can redistribute it and/or modify
@@ -1165,7 +1167,8 @@
       try
       {
          // these can be set per-user
-         String path = Utils.findDirectoryNodePath(ds, FONT_ALIASES, "container", true);
+         String path = Utils.findDirectoryNodePath(ds, FONT_ALIASES, "container", 
+                                                   DirScope.BOTH, null);
          if (path == null)
          {
             if (LOG.isLoggable(Level.INFO))
@@ -1220,7 +1223,8 @@

       try
       {
-         String path = Utils.findDirectoryNodePath(ds, CUSTOM_FONTS, "container", false);
+         String path = Utils.findDirectoryNodePath(ds, CUSTOM_FONTS, "container", 
+                                                   DirScope.BOTH, null);
          if (path == null)
          {
             if (LOG.isLoggable(Level.WARNING))

#88 Updated by Eugenie Lyzenko almost 7 years ago

Constantin Asofiei wrote:

Eugenie, please use this patch; there was a problem that font-aliases was being searched 'per-user', custom-fonts 'per-server' and font-table 'per-both'. I've fixed font-aliases and custom-fonts to be searched 'per-both'.

[...]

Great, this works. Now the picture is the same as I had using (legacy name)<->(new font file) association.

The login page with new fonts:
New fornts, old metrics login

The application starting page:
New fornts, old metrics main

The question still left is using text-metrisc.xml file. As you can see from the login picture above the Password: field has significant difference from what is expected. The reason is difference in text width for MS Sans Serif used in text-metrics.xml and Liberation Sans used for text drawing. And now take a look at the picture taken from text-metrisc.xml with new fonts:
New fonts, new metrics login

This is certainly better. All other texts with long words will be affected too. So the question is why we still use legacy font metrics if we will not provide legacy fonts? What is the mandatory thing that commits us with legacy font metrics? Why don't we provide new fonts within hotel sample with new text metrics?

If we still have to use legacy font metrics then I need to search another font(at least for Liberation Sans) because I think the login page looks not as good as we want it to be.

Let me know what you think.

#89 Updated by Constantin Asofiei almost 7 years ago

Eugenie Lyzenko wrote:

... So the question is why we still use legacy font metrics if we will not provide legacy fonts? What is the mandatory thing that commits us with legacy font metrics? Why don't we provide new fonts within hotel sample with new text metrics?

Text and font metrics are used in computing the implicit width/height for certain widgets. If we don't have the exact width/height, when computing the implicit size may get us incorrect layout (as the widget's size will not match the legacy one).

If we still have to use legacy font metrics then I need to search another font(at least for Liberation Sans) because I think the login page looks not as good as we want it to be.

Yes, please try to find another font.

#90 Updated by Eugenie Lyzenko almost 7 years ago

Constantin Asofiei wrote:

Eugenie Lyzenko wrote:

... So the question is why we still use legacy font metrics if we will not provide legacy fonts? What is the mandatory thing that commits us with legacy font metrics? Why don't we provide new fonts within hotel sample with new text metrics?

Text and font metrics are used in computing the implicit width/height for certain widgets. If we don't have the exact width/height, when computing the implicit size may get us incorrect layout (as the widget's size will not match the legacy one).

This is what I do not understand completely. We have exact metrics for new fonts with new text-metrics.xml having the ability to get a bit different but correct layout.

So the goal is to have exactly the same layout as it is in original 4GL code with legacy fonts, right?

If we still have to use legacy font metrics then I need to search another font(at least for Liberation Sans) because I think the login page looks not as good as we want it to be.

Yes, please try to find another font.

OK.

#91 Updated by Constantin Asofiei almost 7 years ago

Eugenie Lyzenko wrote:

This is what I do not understand completely. We have exact metrics for new fonts with new text-metrics.xml having the ability to get a bit different but correct layout.

Have you proven that the text metrics with the replacement fonts are the same with the 'legacy' fonts? I expect there will be 1-2 pixel differences... or something like this.

So the goal is to have exactly the same layout as it is in original 4GL code with legacy fonts, right?

The layout (thus the font and text metrics on which it relies) is not open to compromise, and that's why we need the metrics captured with the legacy fonts; the drawing, yes, we can compromise here.

#92 Updated by Eugenie Lyzenko almost 7 years ago

Well, for now after more research on the Web, I can say we have two opportunities:
1. Take the font which is very similar to Microsoft Sans Serif and having great shapes but significant width difference(> 2 pixels sometimes). The example is in https://proj.goldencode.com/issues/2765#note-88, login page. The fonts except Liberation Sans that looks god but have same effect: Ubuntu Regular(Ubuntu-R.ttf), Microsoft Yahey Regular from Wine package(msyh.ttf).
2. The other groups of fonts that match more in size condition but look more or less not smooth(I do not say "ugly" because it is too strong). The best I can find at this time is Lato Regular with OFL(Lato-Regular.ttf). Take a look at the Swing login:
Lato Regular Swing login

Main page:
Lato Regular Swing main

Web login:
Lato Regular web login

As you can see the text width is similar to legacy font but words shape is not as good as for legacy one.

Really I think we have to choose from two cases above. If both of them are not acceptable, there is a way number 3 - to create the our own ttf font to use with the FWD applications.

Note, Microsoft Sans Serif is the only font with issues in substitution, the other are OK.

#93 Updated by Greg Shah almost 7 years ago

For option 2, the web client login looks good. How do other web client screens look in Lato Regular? If they look good, it is probably because of anti-aliasing (which we have found cannot be disabled in all browsers). In this case it is possibly helping us.

I agree that Option 2 looks pretty bad in Swing. Try enabling anti-aliasing in Swing and report on how it looks:

https://docs.oracle.com/javase/tutorial/2d/text/renderinghints.html

#94 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

For option 2, the web client login looks good. How do other web client screens look in Lato Regular? If they look good, it is probably because of anti-aliasing (which we have found cannot be disabled in all browsers). In this case it is possibly helping us.

Yes, it is how anti-aliasing helping us in web client. All other windows looks better than swing. Compare the following:
Web client rate page:
Lato Regular Web Rates page

Swing client rate page:
Lato Regular Swing Rates page

#95 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

I agree that Option 2 looks pretty bad in Swing. Try enabling anti-aliasing in Swing and report on how it looks:

https://docs.oracle.com/javase/tutorial/2d/text/renderinghints.html

Yes, using text anti-aliasing makes the screens better. Moreover there are 3 modes of text rendering so we can do full text anti-aliasing or partial. Compare the pictures:

RenderingHints.VALUE_TEXT_ANTIALIAS_ON(full anti-alias).

AA is ON login

AA is ON main

RenderingHints.VALUE_TEXT_ANTIALIAS_GASP(java do anti-alias when required - it is up to java to use or not)

AA is GASP login

AA is GASP main

RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB(according to javadoc - this option uses subpixel LCD approach for LCD displays). Honestly I do not see the difference comparing to VALUE_TEXT_ANTIALIAS_GASP.

AA is LCD_HRGB login

AA is LCD_HRGB main

On my opinion it is better to use full text anti-aliasing(VALUE_TEXT_ANTIALIAS_ON) if there are no cases when we we need certainly solid text. For example the text size is small and anti-aliasing will make them too fuzzy. Just because mixing of solid text and anti-aliased one on the same screen looks a bit weird. And we will be dependent on java decision for when to use text smooth, a bit unpredictable.

#96 Updated by Greg Shah almost 7 years ago

I'm inclined towards using Lato Regular with full anti-aliasing.

Constantin: what do you think?

#97 Updated by Constantin Asofiei almost 7 years ago

Greg Shah wrote:

I'm inclined towards using Lato Regular with full anti-aliasing.

Constantin: what do you think?

4GL drawing is done with anti-aliasing off; if you agree with this difference, then I'm OK with the font usage.

BTW, should we make the anti-aliasing mode (at least for swing) configurable? Maybe someone wants fonts without anti-aliasing...

#98 Updated by Greg Shah almost 7 years ago

4GL drawing is done with anti-aliasing off; if you agree with this difference, then I'm OK with the font usage.

Our text drawing is already different. What are the implications of anti-aliasing?

BTW, should we make the anti-aliasing mode (at least for swing) configurable? Maybe someone wants fonts without anti-aliasing...

I agree. Swing should draw anti-aliased by default when we are using our "replacement fonts" and would default to no anti-aliasing if custom fonts are used. The user should be able to turn it on.

I also agree that this should only affect Swing.

#99 Updated by Eugenie Lyzenko almost 7 years ago

Currently the font anti-aliasing is on in Swing code only(SwingEmulatedWindow.java).

And we can introduce the new directory.xml option that configures the text rendering. Say on the same level as:

...
        <node class="container" name="theme">
...
        <node class="container" name="font-aliases">
...
        <node class="container" name="font-table">
...

#100 Updated by Constantin Asofiei almost 7 years ago

Greg Shah wrote:

4GL drawing is done with anti-aliasing off; if you agree with this difference, then I'm OK with the font usage.

Our text drawing is already different. What are the implications of anti-aliasing?

If the metrics match as closely as possible, and the difference is only visual, I don't think there will be problems. If the text does not exist, metrics will be computed with the drawing font, so using a compatible font will be ok.

Eugenie: please check all replacement fonts with anti-aliasing on; I want to know how it will affect other fonts.

#101 Updated by Eugenie Lyzenko almost 7 years ago

Constantin Asofiei wrote:

Eugenie: please check all replacement fonts with anti-aliasing on; I want to know how it will affect other fonts.

Please clarify. In the anti-aliased pictures above all fonts are replaced. No legacy fonts used there. Do you mean something more?

#102 Updated by Constantin Asofiei almost 7 years ago

Eugenie Lyzenko wrote:

Constantin Asofiei wrote:

Eugenie: please check all replacement fonts with anti-aliasing on; I want to know how it will affect other fonts.

Please clarify. In the anti-aliased pictures above all fonts are replaced. No legacy fonts used there. Do you mean something more?

I don't refer to the legacy fonts, I mean, all the replacement fonts: you've captured/checked metrics for them, but this AFAIK is done with anti-aliasing off. If you enable anti-aliasing, I want to know how this will affect metrics and also if all your replacement fonts will look OK at drawing, when anti-aliasing is on.

#103 Updated by Eugenie Lyzenko almost 7 years ago

Constantin Asofiei wrote:

I don't refer to the legacy fonts, I mean, all the replacement fonts: you've captured/checked metrics for them, but this AFAIK is done with anti-aliasing off.

Yes, this is true.

If you enable anti-aliasing, I want to know how this will affect metrics

Do you mean compare replacement fonts with anti-aliased is ON with legacy metrics with anti-aliased is OFF. Correct?

If we need to capture text-metrics.xml with anti-aliased fonts we need to modify get_text_metrics.c introducing one more option for program - anti-aliasing. I can create branch 2765b to implement this, and we can use this branch to 1) add fix for FontTable.java to enable using font-aliases section and 2) to turn on anti-aliasing in SwingEmulatedWindow.java. Is it OK?

#104 Updated by Constantin Asofiei almost 7 years ago

Eugenie Lyzenko wrote:

Do you mean compare replacement fonts with anti-aliased is ON with legacy metrics with anti-aliased is OFF. Correct?

I think is enough to compare metrics for replacement fonts with anti-aliasing OFF and ON, to give us an idea how a font differs when anti-aliasing is ON.

If we need to capture text-metrics.xml with anti-aliased fonts we need to modify get_text_metrics.c introducing one more option for program - anti-aliasing. I can create branch 2765b to implement this, and we can use this branch to 1) add fix for FontTable.java to enable using font-aliases section and 2) to turn on anti-aliasing in SwingEmulatedWindow.java. Is it OK?

Yes, this is OK.

#105 Updated by Eugenie Lyzenko almost 7 years ago

Constantin Asofiei wrote:

Eugenie Lyzenko wrote:

Do you mean compare replacement fonts with anti-aliased is ON with legacy metrics with anti-aliased is OFF. Correct?

I think is enough to compare metrics for replacement fonts with anti-aliasing OFF and ON, to give us an idea how a font differs when anti-aliasing is ON.

If we need to capture text-metrics.xml with anti-aliased fonts we need to modify get_text_metrics.c introducing one more option for program - anti-aliasing. I can create branch 2765b to implement this, and we can use this branch to 1) add fix for FontTable.java to enable using font-aliases section and 2) to turn on anti-aliasing in SwingEmulatedWindow.java. Is it OK?

Yes, this is OK.

OK. Crating 2765b branch.

#106 Updated by Eugenie Lyzenko almost 7 years ago

Created task branch 2765b from trunk revision 11151.

#107 Updated by Eugenie Lyzenko almost 7 years ago

Constantin Asofiei wrote:

Eugenie Lyzenko wrote:

Do you mean compare replacement fonts with anti-aliased is ON with legacy metrics with anti-aliased is OFF. Correct?

I think is enough to compare metrics for replacement fonts with anti-aliasing OFF and ON, to give us an idea how a font differs when anti-aliasing is ON.

OK. Tested. The result is two metrics sets are absolutely the same for anti-alias is ON and OFF.

#108 Updated by Eugenie Lyzenko almost 7 years ago

Task branch 2765b for review updated to revision 11152.

The update adds the ability to differentiate anti-alias mode when capturing text-metrics.xml in get_text_metrics.c. Also includes the fix for font substitution from Constantin to load font-aliases section.

Also the swing client drawing turns the anti-aliasing ON unconditionally. Let me know if we need this option to be overridden in directory.xml file for persons who prefer avoid font smoothing in swing client. We will have to add client-server conversation call to ask the existed anti-alias overriding. As to me I have no preferences here, may be even it will be better if web and swing clients look the same(with anti-aliasing is ON).

#109 Updated by Eugenie Lyzenko almost 7 years ago

This is the additional picture for classic theme(different new fonts usage). Anti-aliasing is ON.

New fonts classic theme login

New fonts classic theme reservation page

Pretty good looking I guess.

#110 Updated by Greg Shah almost 7 years ago

Also the swing client drawing turns the anti-aliasing ON unconditionally. Let me know if we need this option to be overridden in directory.xml file for persons who prefer avoid font smoothing in swing client.

Please implement the following:

1. The ability to control anti-aliasing (in the Swing client only) using a directory entry. The location you describe in #2765-99 is fine.

2. The default should not unconditionally be anti-aliasing ON. The reason: we don't know the impact on fonts that are not our default (the "replacement fonts"). Please only enable anti-aliasing by default when our replacement fonts are being used.

#111 Updated by Greg Shah almost 7 years ago

I don't think the get_text_metrics.c change needs to be permanent. We know that the original fonts in the Progress environment are used without anti-aliasing. So we need to capture the metrics using disabled anti-aliasing.

#112 Updated by Greg Shah almost 7 years ago

Please integrate the "replacement fonts" as part of the FWD project itself (check them into bzr). Make sure each one has a <font_name>_license.txt file in the same location that provides the license information.

Then make sure that these are used by default. FWD should appear to implement the same font configuration by default as you would see in Progress and our replacement fonts should map into the MS fonts without any further configuration.

Constantin: any thoughts?

#113 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

I don't think the get_text_metrics.c change needs to be permanent. We know that the original fonts in the Progress environment are used without anti-aliasing. So we need to capture the metrics using disabled anti-aliasing.

So I need to undo all changes in get_text_metrics.c for 2765b rev 11152?

#114 Updated by Greg Shah almost 7 years ago

Eugenie Lyzenko wrote:

Greg Shah wrote:

I don't think the get_text_metrics.c change needs to be permanent. We know that the original fonts in the Progress environment are used without anti-aliasing. So we need to capture the metrics using disabled anti-aliasing.

So I need to undo all changes in get_text_metrics.c for 2765b rev 11152?

Yes, I think so.

Constantin: do you see any reason for those changes to be permanent?

#115 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

Please integrate the "replacement fonts" as part of the FWD project itself (check them into bzr). Make sure each one has a <font_name>_license.txt file in the same location that provides the license information.

Planning to make new directory (FWD)/fonts, where (FWD) is the project root. Is it OK?

#116 Updated by Greg Shah almost 7 years ago

Yes.

#117 Updated by Constantin Asofiei almost 7 years ago

Greg Shah wrote:

Constantin: do you see any reason for those changes to be permanent?

I think is better to keep anti-aliasing off by default and turn it on via some program argument. The check to compare metrics with on/off anti-aliasing is still needed, I want to see how this affects the metrics. And I don't see a reason to make this change temporary.

#118 Updated by Greg Shah almost 7 years ago

OK, then just remove the part that prompts the user. Under normal conditions, we won't need to use it. Allow turning it on using a command line option.

#119 Updated by Constantin Asofiei almost 7 years ago

Greg Shah wrote:

Please integrate the "replacement fonts" as part of the FWD project itself (check them into bzr). Make sure each one has a <font_name>_license.txt file in the same location that provides the license information.

Then make sure that these are used by default. FWD should appear to implement the same font configuration by default as you would see in Progress and our replacement fonts should map into the MS fonts without any further configuration.

Constantin: any thoughts?

The fonts I think should reside in the FWD jar - if is outside of it, we might find it difficult to resolve the files.
Also, the replacement font resolution should be done in this order:
  1. is there a replacement font configured in font-aliases in the directory? If so, use that.
  2. otherwise, use our default replacement font.

#120 Updated by Greg Shah almost 7 years ago

In regard to including the fonts in the project itself, they should be added to the p2j.jar as resources and loaded from the jar when needed. We don't want to have to remember to copy them to the target installation. This makes it much easier and it becomes a real default.

#121 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

2. The default should not unconditionally be anti-aliasing ON. The reason: we don't know the impact on fonts that are not our default (the "replacement fonts"). Please only enable anti-aliasing by default when our replacement fonts are being used.

...

Then make sure that these are used by default. FWD should appear to implement the same font configuration by default as you would see in Progress and our replacement fonts should map into the MS fonts without any further configuration.

Constantin Asofiei wrote:

The fonts I think should reside in the FWD jar - if is outside of it, we might find it difficult to resolve the files.
Also, the replacement font resolution should be done in this order:
- is there a replacement font configured in font-aliases in the directory? If so, use that.
- otherwise, use our default replacement font.

Guys, my implementation plan is:

1. Change ui/client/gui/theme/ClassicTheme.java and ui/client/gui/theme/Windows10Theme.java to refer to our fonts selections. This is the point where our font defaults are defined. And this will work when directory.xml has no fonts configured at all. Also in this case(no fonts in directory.xml) we will use anti-aliasing ON for swing client.

2. directory.xml can have override for text anti alias:

...
        <node class="container" name="swing-text-rendering">
          <node class="boolean" name="anti-aliasing">
            <node-attribute name="value" value="true"/>
          </node>
        </node>
...

In this case the directory anti-alias value will have preference over all others does not matter whether fonts are defined in directory.xml or not.

3. If directory.xml does not have override - the FWD will use the ON value if the fonts are getting from point 1 above.

4. Load our fonts from FWD jar file.

If any notes or objections please let me know.

#122 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

OK, then just remove the part that prompts the user. Under normal conditions, we won't need to use it. Allow turning it on using a command line option.

OK.

#123 Updated by Greg Shah almost 7 years ago

The plan is good.

#124 Updated by Constantin Asofiei almost 7 years ago

Eugenie Lyzenko wrote:

Guys, my implementation plan is:

1. Change ui/client/gui/theme/ClassicTheme.java and ui/client/gui/theme/Windows10Theme.java to refer to our fonts selections. This is the point where our font defaults are defined. And this will work when directory.xml has no fonts configured at all. Also in this case(no fonts in directory.xml) we will use anti-aliasing ON for swing client.

If you refer to ClassicTheme.getStandardFontTable, this is not OK; the font-table maps the fonts in the legacy way. Your changes will be in FontTable.buildFontSpecification; this code will need to be changed:

      if (fontID != null)
      {
         WorkArea wa = local.get();

         FontDetails fontAlias = wa.fontAliases.get(fontID.toLowerCase());
         if (fontAlias != null)
         {
            fontDetails.fontAlias = fontAlias;
         }
      }

so that, if the font alias doesn't exist in wa.fontAliases, load our default replacement font and save it in fontDetails.fontAlias. All logic will be on server-side, not on client-side.

2. directory.xml can have override for text anti alias:
[...]
In this case the directory anti-alias value will have preference over all others does not matter whether fonts are defined in directory.xml or not.

I think this is OK.
A quick thought: can the rendering hint to turn anti-aliasing on/off be done just after/before the font is set, and restore it otherwise? I'm thinking, if anti-aliasing can be used with some fonts and not with others, then this setting should be at the font specification (i.e. custom-fonts section or our default replacement font settings).

3. If directory.xml does not have override - the FWD will use the ON value if the fonts are getting from point 1 above.

I think this is OK, but see the previous note.

#125 Updated by Eugenie Lyzenko almost 7 years ago

Constantin Asofiei wrote:

...
If you refer to ClassicTheme.getStandardFontTable, this is not OK; the font-table maps the fonts in the legacy way. Your changes will be in FontTable.buildFontSpecification; this code will need to be changed:
[...]
so that, if the font alias doesn't exist in wa.fontAliases, load our default replacement font and save it in fontDetails.fontAlias. All logic will be on server-side, not on client-side.

Yes, I did mean this place.

If we want t get rid of the MS licensed fonts don't we need to remove all references to them from both directory.xml file and *Theme.getStandardFontTable? Am I wrong?

My idea is the "replacement" fonts to become defaults entirely. And legacy fonts will now be additional font-aliases. Yes, the user can use the fonts from Windows(if having license for Windows). But to do this one must override the defaults in directory.xml either via custom-fonts/font-table or via custom-fonts/font-aliases.

Do you suggest to keep legacy Windows font names in *Theme.getStandardFontTable?

#126 Updated by Constantin Asofiei almost 7 years ago

Eugenie Lyzenko wrote:

Constantin Asofiei wrote:

...
If you refer to ClassicTheme.getStandardFontTable, this is not OK; the font-table maps the fonts in the legacy way. Your changes will be in FontTable.buildFontSpecification; this code will need to be changed:
[...]
so that, if the font alias doesn't exist in wa.fontAliases, load our default replacement font and save it in fontDetails.fontAlias. All logic will be on server-side, not on client-side.

Yes, I did mean this place.

If we want t get rid of the MS licensed fonts don't we need to remove all references to them from both directory.xml file and *Theme.getStandardFontTable? Am I wrong?

The default legacy font table specification in getStandardFontTable and any font-table specified in directory.xml must use the legacy font names as they exist in progress.ini - we can't change these, as this will be our mapping to get the legacy metrics from text-metrics.xml or font-metrics.xml.

My idea is the "replacement" fonts to become defaults entirely.

The replacement fonts will become defaults only for drawing, via FontDetails.fontAlias.

Yes, the user can use the fonts from Windows(if having license for Windows). But to do this one must override the defaults in directory.xml either via custom-fonts/font-table or via custom-fonts/font-aliases.

There is another catch here: if the legacy font (specified in font-table in directory.xml or in getStandardFontTable) is already installed, then that will be used. So, if someone runs FWD on Windows, it will use the MS fonts directly, and bypass the replacement fonts.

Do you suggest to keep legacy Windows font names in *Theme.getStandardFontTable?

See above, we need to keep legacy font names as defined.

#127 Updated by Eugenie Lyzenko almost 7 years ago

Greg,

Making a font list I've got some doubts about DejaVu fonts usage. Take a look at license. Does really it mean the font is free of charge as I thought?

I've got the font from here: https://sourceforge.net/projects/dejavu/

#129 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

The license is here: https://github.com/dejavu-fonts/dejavu-fonts/blob/master/LICENSE

It is fine.

OK. Thanks.

Another font license question.

There are two version forks of the Liberation font available, one - 1.07.4 under GPL v2 with exceptions: https://fedoraproject.org/wiki/Licensing/LiberationFontLicense and another - 2.00.1 under SIL Open Font License, Version 1.1(since version 2.00.0). The info source: https://pagure.io/liberation-fonts.

The fonts are metrically the same, some bug fixing and license type change. So which one we will prefer to use? The Ubuntu 16.04 is bundled with 1.07.4 one.

#130 Updated by Greg Shah almost 7 years ago

Use the 2.00.1 version which is under the SIL OFL 1.1.

#131 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

Use the 2.00.1 version which is under the SIL OFL 1.1.

OK.

#132 Updated by Eugenie Lyzenko almost 7 years ago

Task branch 2765b for review updated to revision 11153.

The update changes the anti-aliasing mode in get_text_metrics.c to be changed only from command line. The default mode when there is no command option - anti-aliasing is OFF.

Also the "replacement" fonts have been added to the branch. One note for Liberation Sans version 2.00.1. I have got the metrics using C tool and found some little difference. Comparing to version 1.07.4 the new font in bold mode has some texts 1 pixel wider than can be obtained for 1.07.4. The texts that have 1 pixel change:

"Password" 
"Password:" 
"Password: " 
"Show Past Accomodations" 
"Show Past Accomodations:" 
"Show Past Accomodations: " 
"Show Past Rates" 
"Show Past Rates:" 
"Show Past Rates: " 
"View" 
"View:" 
"View: " 

No changes between anti-aliasing is ON or OFF for 2.00.1 fonts.

Again, only bold font has the difference. That's why I do not see the difference in UI screens, Liberation Sans does not use bold font for these texts.

So I think it is OK, but if you have any objections - let me know please and we can return to the 1.07.4 version.

Starting to rebase in a 15 min. with new trunk to continue working with 2765b branch for the rest of the changes.

#133 Updated by Eugenie Lyzenko almost 7 years ago

Rebased task branch 2765b from FWD trunk revision 11152. New revision is 11154.

#134 Updated by Eugenie Lyzenko almost 7 years ago

Constantin Asofiei wrote:

If you refer to ClassicTheme.getStandardFontTable, this is not OK; the font-table maps the fonts in the legacy way. Your changes will be in FontTable.buildFontSpecification; this code will need to be changed:
[...]
so that, if the font alias doesn't exist in wa.fontAliases, load our default replacement font and save it in fontDetails.fontAlias. All logic will be on server-side, not on client-side.

Please clarify me your concept here.

1. The font aliases should always be presented, via directory.xml either from FWD jar(becoming default ones) or from server/fonts directory. Another word the font aliases are always in the system having two sets of fonts, correct?

2. The font-table entry is always defined in directory.xml and refers to the legacy fonts, correct? Meaning the FWD will always have two sets of fonts on Windows system, legacy and aliased(either from FWD jar or from server/fonts), correct?

3. If font aliases are always loading and font-table is also always existing how the FWD will decide what font to use? On the Windows system the FWD will always load legacy fonts ignoring aliases? If legacy and replacement fonts defined is it possible to use replacement fonts on Windows?

4. What about Linux based FWD system? If the server/fonts directory does not have the legacy fonts, FWD will use font aliases, correct? The default font replacement are inside jar but can be overridden by user via placing other fonts in server/fonts and defining new replacements in directory.xml, correct?

#135 Updated by Constantin Asofiei almost 7 years ago

Eugenie Lyzenko wrote:

1. The font aliases should always be presented, via directory.xml either from FWD jar(becoming default ones) or from server/fonts directory. Another word the font aliases are always in the system having two sets of fonts, correct?

Font aliases are mandatory only from the FWD jar/runtime; and only if the legacy MS fonts are not already installed in the OS (Greg, do you agree with this?). But, any (optional) font aliases defined in the directory will have precedence over the implicit replacement fonts from FWD jar.

2. The font-table entry is always defined in directory.xml and refers to the legacy fonts, correct?

There is an implicit font-table defined in the FWD runtime; the font-table in the directory is optional and will have precedence over the implicit FWD font table. Any font table (in FWD runtime or directory) will use the legacy font names.

Meaning the FWD will always have two sets of fonts on Windows system, legacy and aliased(either from FWD jar or from server/fonts), correct?

Yes; the legacy fonts will be used for metrics; for drawing, the legacy fonts will be used if they are installed; otherwise, the font alias will be used.

3. If font aliases are always loading and font-table is also always existing how the FWD will decide what font to use? On the Windows system the FWD will always load legacy fonts ignoring aliases? If legacy and replacement fonts defined is it possible to use replacement fonts on Windows?

The rules for drawing will be these:
  1. if the driver finds that the legacy font is installed, use that
  2. otherwise, use the replacement font

4. What about Linux based FWD system? If the server/fonts directory does not have the legacy fonts, FWD will use font aliases, correct? The default font replacement are inside jar but can be overridden by user via placing other fonts in server/fonts and defining new replacements in directory.xml, correct?

Exactly. But only for drawing.

#136 Updated by Greg Shah almost 7 years ago

and only if the legacy MS fonts are not already installed in the OS (Greg, do you agree with this?)

I assume when you say "installed in the OS", you mean that the OS reports the legacy font through APIs. Java can see these fonts without us doing any font loading in FWD. I agree this is a case where any such legacy font that is missing should use the default alias that maps to the replacement font.

But this should only occur if the legacy MS fonts are not present in FWD's local directory (i.e. in our standard project template this is deploy/server/fonts/). If a legacy font is present there (and configured in the directory), then we should load it and use it.

This isn't just for Linux systems. This same basic approach should be used for any system, including Windows. Where Windows differs is not in how FWD code is written, but that on Windows systems we would expect to find the legacy fonts already installed in the OS. But we don't know if that will always be the case. And we don't know that those fonts will always be wanted. We should honor the customer's configuration overrides (including loading FWD-specific fonts from deploy/server/fonts/, aliases and so on, no matter what the platform.

#137 Updated by Eugenie Lyzenko almost 7 years ago

OK. Another point.

1. Both Linux and Windows systems can have the legacy and "replacement" fonts installed as system wide(If user use dual boot and has legal Windows copy).
2. Both Linux and Windows systems can have legacy and replacement fonts installed in deploy/server/fonts and configured them in directory.xml

And the question: Should we make the difference between Windows and Linux instances of the FWD in this condition? Why do not we use the same font selection rules for both systems?

#138 Updated by Eugenie Lyzenko almost 7 years ago

While I'm working on font loading implementation let me publish the font usage plan in order of preference. Just for all of us to know what is planned to be happening. It helps me to understand and go the right way.

For every font ID fontX or font purpose(like default-font for eg.):
1. If legacy font(defined in directory.xml or within defaults from theme definition) installed in OS - use it.
If not:
2. If legacy font(defined in directory.xml or within defaults from theme definition) is inside deploy/server/fonts - load and use it.
If not:
3. If replacement font(defined in directory.xml or within defaults from theme definition) installed in OS - use it.
If not:
4. If replacement font(defined in directory.xml or within defaults from theme definition) is inside deploy/server/fonts - load or get from jar and use it.

For point numbers 3 and 4 if directory.xml has overridden option for anti-aliasing - use mode defined in directory.xml otherwise use default ON anti-aliasing for replacement fonts.

The order is not depending on what OS is used to run FWD, both Windows and Linux will go the same way.

So if there are any objections or notes - please let me know.

#139 Updated by Eugenie Lyzenko almost 7 years ago

Task branch 2765b for review updated to revision 11155.

Some preparation steps added. The method to get the anti-aliasing option from server. Also the project build script changed to incorporate the fonts directory content into jar file with our default replacement fonts.

#140 Updated by Eugenie Lyzenko almost 7 years ago

Task branch 2765b for review updated to revision 11156.

This update adds the ability to have current theme dependent default font aliases with ability to override them in directory.xml The entries from directory.xml have a preference. In the case of missing alias definition in directory.xml the default value is used instead. Theme dependent alias defaults are passing from client to server in the same call as other default fonts, so no additional performance penalty happen.

Now the FWD always has a legacy font set aliased with replacement ones. So the next step is to implement proper usage of them depending on current OS font installations, deploy/server/fonts directory contents and so on.

Continue working.

#141 Updated by Eugenie Lyzenko almost 7 years ago

The rule set(https://proj.goldencode.com/issues/2765#note-138) has been changed to reflect the fact we can not have legacy fonts inside our jar.

#142 Updated by Greg Shah almost 7 years ago

Should we make the difference between Windows and Linux instances of the FWD in this condition?

No. This is exactly what I said in #2765-136. Do NOT make the font processing conditional on the OS type.

Why do not we use the same font selection rules for both systems?

I want you to do this.

So if there are any objections or notes - please let me know.

Your plan in #2765-138 is good.

#143 Updated by Eugenie Lyzenko almost 7 years ago

Task branch 2765b for review updated to revision 11157.

This is the implementation candidate for new font loading order according to plan #2765-138. The directory defined fonts have preference over default ones. And the legacy fonts(if can be found in OS or deploy/server/fonts) have preference over replacement fonts.

The directory boolean entry swing-text/anti-aliasing can be used to override anti-aliasing mode for replacement fonts. If not defined in directory - the approach is to use ON when at least one font the FWD uses is from replacement set. The complete legacy set will not use anti-aliasing. Only Swing client affected anti-aliasing hint mode.

Need to review and test different config combination but the general implementation is ready.

Also I have found another bug in hotel application related client starters. The files:

(Hotel_GUI)/deploy/client/client.cmd
(Hotel_ChUI)/deploy/client/client-swing.cmd
(Hotel_ChUI)/deploy/client/client-swing.cmd

Have the same issue with debug mode setup on Windows:

...
   if "%carg%" equ "-d" (
      set /A "i=i+1" 
      call :setvar debug !i!
      set /A debug=!debug!
...

This does not allow to start client -d port and to attach debugger session. The correct code is:
...
   if "%carg%" equ "-d" (
      set /A "i=i+1" 
      call :setvar dport !i!
      set /A debug=1
...

Should I fix it in both ChUI and GUI hotel application repositories?

#144 Updated by Greg Shah almost 7 years ago

Should I fix it in both ChUI and GUI hotel application repositories?

Yes.

#145 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

Should I fix it in both ChUI and GUI hotel application repositories?

Yes.

Updated the ChUI and GUI hotel bzr repos to versions 131 and 46 respectively.

#146 Updated by Eugenie Lyzenko almost 7 years ago

Task branch 2765b for review updated to revision 11158.

This update includes code optimization and issue fix for final anti-alias checking. This is moved to the registerFontTable() method when last fonts for session is setting up. So I need some new Windows testing and notes feedback in the case I have missed for something.

#147 Updated by Constantin Asofiei almost 7 years ago

Eugenie Lyzenko wrote:

Task branch 2765b for review updated to revision 11158.

The changes look good. Please do some testing on Windows/Ubuntu with installed/not installed legacy and replacement fonts, and see how it works.

#148 Updated by Eugenie Lyzenko almost 7 years ago

Constantin Asofiei wrote:

Eugenie Lyzenko wrote:

Task branch 2765b for review updated to revision 11158.

The changes look good. Please do some testing on Windows/Ubuntu with installed/not installed legacy and replacement fonts, and see how it works.

OK. I have found serious bug in implementation. If there is no font-aliases section in directory - the default theme dependent aliases is not setting up. Testing the fix now. Planning to commit the fix soon.

#149 Updated by Eugenie Lyzenko almost 7 years ago

Guys,

Another points for font usage just found. If the replacement fonts is not defined in directory - they are not loading from deploy\server\fonts nor from FWD jar.

The questions

1. Is the custom-fonts section mandatory in directory.xml?
2. Can I add our replacement fonts into custom-fonts section as permanent entries to fix this case loading issue?

The server loads the custom fonts before the client asks the fonts for current theme. Or may be it will be better to load all our replacement fonts on the stage when custom fonts are loading(for the case when there is no custom-fonts section in directory.xml or the section is incomplete)?

What do you think?

#150 Updated by Constantin Asofiei almost 7 years ago

Eugenie Lyzenko wrote:

Or may be it will be better to load all our replacement fonts on the stage when custom fonts are loading(for the case when there is no custom-fonts section in directory.xml or the section is incomplete)?

I think this is the way to go, load the replacement font defs as 'custom-fonts' at the same time as the ones loaded from the directory.

#151 Updated by Eugenie Lyzenko almost 7 years ago

Constantin Asofiei wrote:

Eugenie Lyzenko wrote:

Or may be it will be better to load all our replacement fonts on the stage when custom fonts are loading(for the case when there is no custom-fonts section in directory.xml or the section is incomplete)?

I think this is the way to go, load the replacement font defs as 'custom-fonts' at the same time as the ones loaded from the directory.

OK.

#152 Updated by Eugenie Lyzenko almost 7 years ago

Task branch 2765b for review updated to revision 11159.

This is changes and fixes as the result of testing on minimalistic system. When no fonts are installed, no aliases defined. The issues with loading aliases fonts when no font-aliases section in directory. Also the change to load default custom fonts in the case the custom-fonts section is missing or redefines only partial fonts. The default custom fonts are the replacement fonts set has been integrated into FWD jar.

Also the default-font alias for Windows 10 theme has been changed to Lato,8 from Open Sans,9 due to poor looking and missing * chars to represent password input.

I consider testing completed for Windows system. If required I will perform the same check for Linux without some installed fonts(it is a bit complex because the fonts we use as replacement are in the Ubuntu box mostly). The exception is Lato font which is unknown for Ubuntu. So I need to set up Ubuntu VM to remove the fonts and not to destroy my working Linux system.

#153 Updated by Greg Shah almost 7 years ago

If required I will perform the same check for Linux without some installed fonts(it is a bit complex because the fonts we use as replacement are in the Ubuntu box mostly). The exception is Lato font which is unknown for Ubuntu. So I need to set up Ubuntu VM to remove the fonts and not to destroy my working Linux system.

Yes, please do this Linux testing. This is a common case that will be seen.

#154 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

If required I will perform the same check for Linux without some installed fonts(it is a bit complex because the fonts we use as replacement are in the Ubuntu box mostly). The exception is Lato font which is unknown for Ubuntu. So I need to set up Ubuntu VM to remove the fonts and not to destroy my working Linux system.

Yes, please do this Linux testing. This is a common case that will be seen.

OK.

#155 Updated by Eugenie Lyzenko almost 7 years ago

The Linux system testing completed.

1. The font loading plan is working fine. If fonts are not known to the system the legacy fonts is loading from deploy/server/fonts directory or if missing the default aliases are loading from deploy/server/fonts or jar.

2. There are some consideration I have discovered during this testing:

- the web client works differently when checking if the font installed. This is because Web browser has it's own font mapper(at least for Windows) and produce the TRUE results even if the exact font is not installing. In this case FWD thinks the font is installed and uses mapping provided by browser. And I can say it looks good(as if the original font is installed). So I think we are OK here.

- another point is related to the font rendering with standard font-table section and with font files in the deploy/server/fonts. In this case the swing client should draw the text with anti-aliasing OFF. But take a look at font-table:

...
        <node class="container" name="font-table">
          <node class="string" name="default-font">
            <node-attribute name="value" value="MS Sans Serif, size=8"/>
          </node>
          <node class="string" name="default-fixed-font">
            <node-attribute name="value" value="Courier New, size=8"/>
          </node>
          <node class="string" name="font0">
            <node-attribute name="value" value="FixedSys"/>
          </node>
          <node class="string" name="font1">
            <node-attribute name="value" value="System"/>
          </node>
...

The problem is in font "font1/System". This font has no file associated in standard config but it has default alias for both themes(Open Sans or Liberation Sans). And when the font is preparing to load and use the FWD can not find the font file and load font alias instead. But loading at least single alias font means turning text rendering hint ON for smoothing. As a result we have the Swing client with anti-aliasing hint as ON when we even do not use this font and all legacy fonts are in deploy/server/fonts.

I think we need to change directory.xml default config adding one more custom font:

...
          <node class="container" name="font10">
            <node class="string" name="font">
              <node-attribute name="value" value="System"/>
            </node>
            <node class="string" name="file">
              <node-attribute name="value" value="fonts/fsex301-l2.ttf"/>
            </node>
          </node>
...

This is the fixed sys excelsior we already use. This gives the client with text anti-aliasing to be OFF. Is this change OK? Or we can make swing anti-aliasing OFF by explicit(this is also works):
...
        <node class="container" name="swing-text">
          <node class="boolean" name="anti-aliasing">
            <node-attribute name="value" value="FALSE"/>
          </node>
        </node>
...

In general the approach works as expected and I think can be integrated int current FWD trunk. This is GUI specific so I'm not sure the regression testing is mandatory.

#156 Updated by Eugenie Lyzenko almost 7 years ago

OK. Let's clarify the purpose of the font called "System".

Is this a fallback font for the cases when default font is not specified? Now we always specify all fonts explicitly via directory or implicitly via theme classes. Do we still need this font to be presented?

Or the "System" font is the font that ALWAYS exists on every system? The OS GUI always has at least one font defined and this system font is a last resort for the cases when other fonts are missing or broken? In this case we need to detect for both Linux and Windows what is the name of this "system" font. It can be different for different OS.

Or the "System" font is from another category I have missed. Please let me know if so.

#157 Updated by Eugenie Lyzenko almost 7 years ago

Another opportunity to resolve "System" font note.

1. Assume the System font is always installed.
2. Change the font manager code to implement this:
from:

      public FontDetails<?> createFont(FontDetails<?> details)
      {
...
            if (driver.isFontInstalled(details.fontName))
            {
               // the legacy font is system wide

to
      public FontDetails<?> createFont(FontDetails<?> details)
      {
...
            if (driver.isFontInstalled(details.fontName) ||
                details.fontName.equalsIgnoreCase("system"))
            {
               // the legacy font is system wide

This eliminates requirement to modify directory file adding "System" font file association, passing the respective font loading up to Java internal. Tested for both Windows and Linux systems and confirmed as working solution.

So if no objection I will commit this change in a 10 min.

#158 Updated by Eugenie Lyzenko almost 7 years ago

Task branch 2765b for review updated to revision 11160.

The change to consider System font as always installed in OS. The idea is in previous message.

So I guess the changes and testing completed.

#159 Updated by Constantin Asofiei almost 7 years ago

Eugenie, I don't understand this code in FontManager.createFont:

            // check if the legacy font is system wide, the "system" font is considering
            // as always installed
            if (driver.isFontInstalled(details.fontName) ||
                details.fontName.equalsIgnoreCase("system"))

This will remove any font alias or font definition defined for it. So, how is this font supposed to work? Do you have a free-license replacement for the System font?

Also, please provide a list of all replacement fonts: look into the font-table defined at the Hotel GUI app and the large GUI app, and see which are not in the default FWD font-table for both the classic and win10 themes and also check if all have good replacements.

The idea is: if there are fonts which are not part of the classic/win10 theme, the implicit replacement definition should still be encoded in FWD. Otherwise, we will have to duplicate info accross directories', customers, etc.

#160 Updated by Eugenie Lyzenko almost 7 years ago

Constantin Asofiei wrote:

Eugenie, I don't understand this code in FontManager.createFont:
[...]
This will remove any font alias or font definition defined for it. So, how is this font supposed to work? Do you have a free-license replacement for the System font?

The idea is described in https://proj.goldencode.com/issues/2765#note-156, https://proj.goldencode.com/issues/2765#note-157. The main point: we always have the "System" font installed. We do not need replacement(and I have no one), just asking java to obtain "System" font.

Otherwise we will have to associate the font file with System font. See https://proj.goldencode.com/issues/2765#note-155, point 2.

#161 Updated by Constantin Asofiei almost 7 years ago

Eugenie Lyzenko wrote:

The idea is described in https://proj.goldencode.com/issues/2765#note-156, https://proj.goldencode.com/issues/2765#note-157. The main point: we always have the "System" font installed. We do not need replacement(and I have no one), just asking java to obtain "System" font.

Sorry, I recall now, we had this discussion with a customer at some point (that System font is not used for drawing); also, as Java can't really use System font (which is a bitmap font), at worst case users will have to choose a different font for it.

Otherwise we will have to associate the font file with System font. See https://proj.goldencode.com/issues/2765#note-155, point 2.

OK, I understand your opinion, but we should still allow the user to override this font via an alias (if it wants). So, your problem is that using a font alias, it will trigger anti-aliasong=on. What about this: can't we make the anti-aliasing settable for each font? Maybe a mix of global anti-aliasing flag and per-font name flags? This would help us have a more granular approach...

Greg: at this point, if there is something more urgent, we can postpone this and finish it at a later time.

#162 Updated by Eugenie Lyzenko almost 7 years ago

Constantin Asofiei wrote:

Also, please provide a list of all replacement fonts: look into the font-table defined at the Hotel GUI app and the large GUI app, and see which are not in the default FWD font-table for both the classic and win10 themes and also check if all have good replacements.

The idea is: if there are fonts which are not part of the classic/win10 theme, the implicit replacement definition should still be encoded in FWD. Otherwise, we will have to duplicate info accross directories', customers, etc.

The current replacement font table is:

Tahoma -> Wine Tahoma
Courier New -> Liberation Mono
Segoe UI - > Open Sans
Microsoft Sans Serif -> Liberation Sans
MS Sans Serif -> Lato
Fixed Sys Excelsior -> DejaVu Sans

We have all font replacement now. And I think the defaults are in theme specific encoding plus the directory.xml we currently provide. So I do not understand what

the implicit replacement definition should still be encoded in FWD

do you mean.

#163 Updated by Constantin Asofiei almost 7 years ago

Eugenie Lyzenko wrote:

The current replacement font table is:
[...]

We have all font replacement now. And I think the defaults are in theme specific encoding plus the directory.xml we currently provide. So I do not understand what

the implicit replacement definition should still be encoded in FWD

do you mean.

As the mapping you provided reaches all fonts (in Hotel GUI, large GUI app and standard legacy font table), then we are OK.

Please document this mapping in the FontTable javadoc.

#164 Updated by Eugenie Lyzenko almost 7 years ago

Constantin Asofiei wrote:

OK, I understand your opinion, but we should still allow the user to override this font via an alias (if it wants). So, your problem is that using a font alias, it will trigger anti-aliasong=on.

Yes.

What about this: can't we make the anti-aliasing settable for each font? Maybe a mix of global anti-aliasing flag and per-font name flags? This would help us have a more granular approach...

This will make the drawing very complex, we will need to track what font is using for text, change the rendering mode before almost any text drawing... And as a "bonus" we will have a picture with mixed smooth and sharp text which can be considered by someone as a bug I guess. Do we really need this granularity?

#165 Updated by Eugenie Lyzenko almost 7 years ago

Constantin Asofiei wrote:

As the mapping you provided reaches all fonts (in Hotel GUI, large GUI app and standard legacy font table), then we are OK.

Please document this mapping in the FontTable javadoc.

OK.

#166 Updated by Constantin Asofiei almost 7 years ago

Eugenie Lyzenko wrote:

This will make the drawing very complex, we will need to track what font is using for text, change the rendering mode before almost any text drawing...

We can set the anti-aliasing when the font is changed, deep in the Swing GUI Driver.

And as a "bonus" we will have a picture with mixed smooth and sharp text which can be considered by someone as a bug I guess. Do we really need this granularity?

Hmm... I didn't consider this one, thanks for catching it. So my idea doesn't look that good.

#167 Updated by Greg Shah almost 7 years ago

Greg: at this point, if there is something more urgent, we can postpone this and finish it at a later time.

Please finish it now.

#168 Updated by Greg Shah almost 7 years ago

Sorry, I recall now, we had this discussion with a customer at some point (that System font is not used for drawing); also, as Java can't really use System font (which is a bitmap font), at worst case users will have to choose a different font for it.

Some customers might use it for drawing too. I think we need to have a "built-in" replacement font for the Windows System bitmap font.

#169 Updated by Constantin Asofiei almost 7 years ago

Greg Shah wrote:

Sorry, I recall now, we had this discussion with a customer at some point (that System font is not used for drawing); also, as Java can't really use System font (which is a bitmap font), at worst case users will have to choose a different font for it.

Some customers might use it for drawing too. I think we need to have a "built-in" replacement font for the Windows System bitmap font.

Yes, I think this is the way to go, find a replacement.

#170 Updated by Eugenie Lyzenko almost 7 years ago

Constantin Asofiei wrote:

Greg Shah wrote:

Some customers might use it for drawing too. I think we need to have a "built-in" replacement font for the Windows System bitmap font.

Yes, I think this is the way to go, find a replacement.

Guys,

Currently the themes already use default aliases for System font:
Classic -> Liberation Sans
Windows10 -> Open Sans

Do you think we need another replacement? What text is drawing with System font?

#171 Updated by Greg Shah almost 7 years ago

Currently the themes already use default aliases for System font:
...
Do you think we need another replacement? What text is drawing with System font?

For that specific customer, nothing was drawn with it. But I worry that other applications might use the font1 which by default in Progress maps to System.

As long as we always have a default mapping for font1 to a replacement font, then I think it is OK.

I guess I don't understand why we would need special processing for System in this case.

#172 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

For that specific customer, nothing was drawn with it. But I worry that other applications might use the font1 which by default in Progress maps to System.

I see.

As long as we always have a default mapping for font1 to a replacement font, then I think it is OK.

I guess I don't understand why we would need special processing for System in this case.

The problem is we currently do not have the legacy font associated with System. On the other hand the System font has an alias as all other fonts. So when user wants to load legacy fonts either from deploy/server/fonts or from OS the System font does not have file to load and is not in the list of the fonts installed in OS (yes, neither Windows nor Linux have embedded "System" font family). So in this case the FWD is loading font alias(either from deploy/server/fonts or from jar). And this automatically turn font smoothing ON. The result - we do not use the System font and has legacy font files but the text become smoothed.

#173 Updated by Eugenie Lyzenko almost 7 years ago

Another possible approach is:

Make an exception for System font - loading this font from alias will NOT trigger the anti-aliasing hint to ON. What do you think?

#174 Updated by Greg Shah almost 7 years ago

Another possible approach is:

Make an exception for System font - loading this font from alias will NOT trigger the anti-aliasing hint to ON. What do you think?

Although this is possible, the problem is really more general.

What you are saying is that whenever at least 1 of the legacy fonts exists (in the OS or in deploy/server/fonts/) but 1 or more do not exist, then the act of having an automatic replacement to our fallback fonts will cause anti-aliasing to be turned on for all fonts. This is really not specific to System, except that we don't have a default legacy bitmap font that would be loaded normally, so it causes this to occur more commonly.

What about this: can't we make the anti-aliasing settable for each font? Maybe a mix of global anti-aliasing flag and per-font name flags? This would help us have a more granular approach...

This will make the drawing very complex, we will need to track what font is using for text, change the rendering mode before almost any text drawing... And as a "bonus" we will have a picture with mixed smooth and sharp text which can be considered by someone as a bug I guess. Do we really need this granularity?

I think we need to consider this case. If someone provides some legacy fonts and not a font for one or more (System or some other one), then we probably need to have any of the legacy fonts as not anti-aliased while having the replacement fonts anti-aliased.

Can you test this to see what it would look like?

This will make the drawing very complex, we will need to track what font is using for text, change the rendering mode before almost any text drawing...

We can set the anti-aliasing when the font is changed, deep in the Swing GUI Driver.

We just need to track the anti-aliasing setting at a per-font level. Then when the font is changed (in Swing only), that code would change the anti-aliasing hint to match.

Please try this out and let's see how it looks.

#175 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

Another possible approach is:

Make an exception for System font - loading this font from alias will NOT trigger the anti-aliasing hint to ON. What do you think?

Although this is possible, the problem is really more general.

What you are saying is that whenever at least 1 of the legacy fonts exists (in the OS or in deploy/server/fonts/) but 1 or more do not exist, then the act of having an automatic replacement to our fallback fonts will cause anti-aliasing to be turned on for all fonts. This is really not specific to System, except that we don't have a default legacy bitmap font that would be loaded normally, so it causes this to occur more commonly.

Yes, as soon as we use at least 1 font replacement the anti-aliasing is becoming ON automatically for all fonts. And this is not System font specific, this font is just an example of missed one.

On the other hand System fond has some specific I think. If we ask java to load System font - we will get some font in any case. Just because OS GUI always has at least 1 font. Am I wrong? The idea here to pass font mapping decision up to JRE or OS font mapper.

What about this: can't we make the anti-aliasing settable for each font? Maybe a mix of global anti-aliasing flag and per-font name flags? This would help us have a more granular approach...

This will make the drawing very complex, we will need to track what font is using for text, change the rendering mode before almost any text drawing... And as a "bonus" we will have a picture with mixed smooth and sharp text which can be considered by someone as a bug I guess. Do we really need this granularity?

I think we need to consider this case. If someone provides some legacy fonts and not a font for one or more (System or some other one), then we probably need to have any of the legacy fonts as not anti-aliased while having the replacement fonts anti-aliased.

Can you test this to see what it would look like?

OK.

This will make the drawing very complex, we will need to track what font is using for text, change the rendering mode before almost any text drawing...

We can set the anti-aliasing when the font is changed, deep in the Swing GUI Driver.

We just need to track the anti-aliasing setting at a per-font level. Then when the font is changed (in Swing only), that code would change the anti-aliasing hint to match.

Please try this out and let's see how it looks.

OK.

#176 Updated by Greg Shah almost 7 years ago

If we ask java to load System font - we will get some font in any case. Just because OS GUI always has at least 1 font. Am I wrong? The idea here to pass font mapping decision u to JRE or OS font mapper.

We can't depend on Java to randomly provide a font that looks good. We must have an explicit font choice by the customer OR an explicit replacement font as a fallback.

#177 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

If we ask java to load System font - we will get some font in any case. Just because OS GUI always has at least 1 font. Am I wrong? The idea here to pass font mapping decision up to JRE or OS font mapper.

We can't depend on Java to randomly provide a font that looks good. We must have an explicit font choice by the customer OR an explicit replacement font as a fallback.

OK.

Task branch 2765b for review updated to revision 11161.

This is the javadoc change to add replacement font table.

#178 Updated by Eugenie Lyzenko almost 7 years ago

On the pictures below the example of the System, size=8 font taken from JAR/OS used instead of default MS Sans Serif, size=8. As you can see the font is significantly wider than we expect to have. I think it is a kind of Arial font.

Linux:
System font sample Linux

Windows:
System font sample Windows

So if the font will be different depending on JRE/OS decision - we will have picture differences we can not control.

And the question I still need to be answered is: what is the purpose of the System font in 4GL? It is just fallback for the cases there is no default font defined? Or there are the text to be drawn with this font?

I just want to see how the text with this font looks to verify the chosen replacement is OK. Or the only we have is the width/height values in text-metrics.xml?

#179 Updated by Constantin Asofiei almost 7 years ago

And the question I still need to be answered is: what is the purpose of the System font in 4GL? It is just fallback for the cases there is no default font defined? Or there are the text to be drawn with this font?

Eugenie, please see this note https://proj.goldencode.com/issues/2322#note-3 where there is an explanation about the System font used by 4GL.

#180 Updated by Eugenie Lyzenko almost 7 years ago

Constantin Asofiei wrote:

Eugenie, please see this note https://proj.goldencode.com/issues/2322#note-3 where there is an explanation about the System font used by 4GL.

Thanks, this explains many things. The pictures for Windows(XP and 7) system fonts.

Windows XP:
System font XP

Windows 7:
System font W7

The font is raster type, only bold and only size=10. And certainly this is not what we getting asking JRE to provide System font from OS. I think because Java can not use non-scalable fonts(like ones we have for *.fon file).

So I'm going to check if our replacement looks the same as the pictures above. And to check how the partial font anti-aliasing will look(mixing smooth and sharp text in the same Swing client window).

#181 Updated by Eugenie Lyzenko almost 7 years ago

This is the DejaVu Sans, bold, size=10 as the best replacement font for System look from previous message.

DejaVu Sans bold 10 as System font

Task branch 2765b for review updated to revision 11162.

This is the set of changes/fixes related to system font management as the part of preparation to new smooth drawing approach.
1. The font alias for System font has been changed to DejaVu Sans, bold, size=10 for both Classic and Windows10 themes.
2. I have fount a bug/issue with font style implementation for the case when we use font installed in system. If we previously loaded font from file/jar the bold attribute was reset to false(because we load data file with bold font). However if client found the font is installed in system the bold style option must be restored to initial state, otherwise we are not getting bold font properly.

Continue working on mixed drawing for ON/OFF anti-aliasing text modes within same client window.

#182 Updated by Eugenie Lyzenko almost 7 years ago

Greg, Constantin,

Here is the pictures set demonstrating mixture of the smooth and sharp text in the same session.

The font alias is used for default-font, legacy for others:
Default Win10
Default Classic

The font alias is used for default-fixed-font, legacy for others:
Default Mono Win10
Default Mono Classic

I can say it looks better than I have expected.

So it it is OK for you - I will refactor the anti-aliasing implementation respectively. BTW client-server calls are simplified with this new approach. Only swing client side font selection makes extra work a bit.

The System font issue is also gone with this change.

#183 Updated by Greg Shah almost 7 years ago

It is not clear what I'm looking at.

Which font is used for the title bar? That font is very jagged, especially in the windows 10 theme. Presumably this is a legacy font, but I don't recall the legacy fonts looking so bad.

Otherwise the change is OK.

#184 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

It is not clear what I'm looking at.

Which font is used for the title bar? That font is very jagged, especially in the windows 10 theme. Presumably this is a legacy font, but I don't recall the legacy fonts looking so bad.

This is legacy Segoe UI, size=10 for Windows 10 theme and legacy Tahoma, size=8, bold for Classic(the windows-title-font is not redefined in directory, just theme's defaults). Both fonts were loaded from deploy/server/fonts directory for pictures above. So this is what we were able to see before I think.

#185 Updated by Greg Shah almost 7 years ago

OK, go ahead with the solution as planned.

#186 Updated by Eugenie Lyzenko almost 7 years ago

Task branch 2765b for review updated to revision 11163.

This is the new approach for text anti-aliasing. Now it is possible to have mixed mode text in same swing client window. The idea is to set up all preparation steps on the server side. Every replacement font will be drawn with anti-aliasing. If the font is legacy - it does not use anti-aliasing mode. And the mode can be redefined by setting anti-aliasing to FALSE in the directory.

#187 Updated by Constantin Asofiei almost 7 years ago

Eugenie, the changes in 2765b rev 11163 are OK; please add a history entry to FontDetails and also a question about the System font replacement: is DejaVu Sans, bold, size=10 enough? Have you compared the font metrics against the System ones?

Also, do we need to configure the Hotel GUI project with the new replacement fonts?

#188 Updated by Eugenie Lyzenko almost 7 years ago

Constantin Asofiei wrote:

Eugenie, the changes in 2765b rev 11163 are OK; please add a history entry to FontDetails

Fixed in revision 11164.

and also a question about the System font replacement: is DejaVu Sans, bold, size=10 enough?

I think yes, see note #181 above.

Have you compared the font metrics against the System ones?

I did not make this comparison because I guess the System font is not proportional. This is the bitmap font with fixed size, assuming 10. Looking at direct comparison I've found it is the best substitution we can have.

Also, do we need to configure the Hotel GUI project with the new replacement fonts?

The Hotel GUI project will use the aliases even they are not directly included into directory. And my point the regular Windows fonts will look better(in most cases), so if the system has regular fonts installed - it is better to use them.

We just do not need to provide separate font files within GUI package.

#189 Updated by Constantin Asofiei almost 7 years ago

Eugenie Lyzenko wrote:

The Hotel GUI project will use the aliases even they are not directly included into directory. And my point the regular Windows fonts will look better(in most cases), so if the system has regular fonts installed - it is better to use them.

We just do not need to provide separate font files within GUI package.

OK, so your point is that nothing needs to be changed for Hotel GUI font configuration, correct?

Next step is: please do some testing in some complex screens of the large GUI application and see how the application behaves. And also, you can do a ChUI runtime testing, to check for unexpected errors.

#190 Updated by Eugenie Lyzenko almost 7 years ago

Constantin Asofiei wrote:

We just do not need to provide separate font files within GUI package.

OK, so your point is that nothing needs to be changed for Hotel GUI font configuration, correct?

Yes, the idea is the default replacement is inside theme defaults. The Hotel GUI font configuration change may require if someone wants to use another regular or alias fonts for example.

#191 Updated by Eugenie Lyzenko almost 7 years ago

Constantin Asofiei wrote:

Next step is: please do some testing in some complex screens of the large GUI application and see how the application behaves. And also, you can do a ChUI runtime testing, to check for unexpected errors.

Task branch 2765b for review updated to revision 11165.

Small adjustment for font name and size for Windows10 theme. Now the large scale GUI application looks acceptable in Swing and Web clients. Some font aliases default font were too large had poor looking fonts. Now fixed.

So starting ChUI regression testing.

#192 Updated by Constantin Asofiei almost 7 years ago

Eugenie Lyzenko wrote:

Small adjustment for font name and size for Windows10 theme. Now the large scale GUI application looks acceptable in Swing and Web clients. Some font aliases default font were too large had poor looking fonts. Now fixed.

Do we have to do any other custom configuration for the large scale GUI app?

So starting ChUI regression testing.

How is this going?

#193 Updated by Eugenie Lyzenko almost 7 years ago

Constantin Asofiei wrote:

So starting ChUI regression testing.

How is this going?

All tests are OK except navigation/user_and_dev_help. Need to test manually.

#194 Updated by Eugenie Lyzenko almost 7 years ago

Constantin Asofiei wrote:

Eugenie Lyzenko wrote:
Do we have to do any other custom configuration for the large scale GUI app?

I do not know about such requirements.

How is this going?

The testing completed. Failed test was run in standalone mode. The results can be seen in 2765b_11165_ddff287_20170616_evl.zip. The servers are now stopped.

#195 Updated by Constantin Asofiei almost 7 years ago

Eugenie Lyzenko wrote:

The testing completed. Failed test was run in standalone mode. The results can be seen in 2765b_11165_ddff287_20170616_evl.zip. The servers are now stopped.

Greg, as testing passed, I'm OK with merging to trunk.

#196 Updated by Greg Shah almost 7 years ago

Please merge to trunk

#197 Updated by Eugenie Lyzenko almost 7 years ago

Greg Shah wrote:

Please merge to trunk

Branch 2765b was merged to trunk as revno 11153 then it was archived.

#198 Updated by Greg Shah almost 7 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

#199 Updated by Constantin Asofiei almost 6 years ago

Eugenie, what is the way to find replacement fonts, having a font-table of 48 entries, over 7 fonts (with bold/normal variations)?

#200 Updated by Eugenie Lyzenko almost 6 years ago

Constantin Asofiei wrote:

Eugenie, what is the way to find replacement fonts, having a font-table of 48 entries, over 7 fonts (with bold/normal variations)?

I'm not sure I understand what are you asking for. Please clarify. In general the way to find a replacement I used was manual selecting some candidates that looks similar, then use FontForge Windows program to make some preliminary casting from candidates to get better matches (the utility allows to see the font metrics) and then to use out text metrics utility to find the nest matches (+-1-2 pixels precision).

Or you asking for something different?

Also available in: Atom PDF