Project

General

Profile

Windows GUI to Web Migration

Introduction

The most complex conversion project is usually related to applications which are current running as a Windows Desktop/4GL GUI and which are being migrated to a Linux-based Web/Cloud application. The reasons to move away from Windows Desktop GUI are probably quite obvious to most readers. Linux is virtually always chosen here for many practical reasons:

  • it is less expensive and removes restrictive licensing issues
  • it is easier to implement, deploy and support in the cloud than Windows

This chapter documents the issues that can be seen in such migrations and provides guidance on how to resolve these issues.

OCX Usage

Legacy Text Metrics and Font Usage

After converting the application, FWD requires knowledge about the metrics of the various fonts and texts used by your legacy application so that the frame layout (when implicit dimension or location are used for widgets) can be computed correctly.

There are tools to collect this information so that your application layout looks as close as possible to the original. To use them, information from the legacy environment must be gathered.

Setup

Gather font information from progress.ini or a specific .ini file utilized by the application. If there are DefaultFixedFont and DefaultFont entries, the syntax for those sections is:

DefaultFixedFont or DefaultFont = typeface, [ size point-size, keyword, ... ], [ script = scriptname ]
where
Keyword Meaning
typeface A valid typeface, such as Times of Courier
point-size The size of the font, in points. If you omit the point size, the default point size as defined by the typeface is used.
keyword bold, italic, underline or strikeout
scriptname By default, Windows FixedSys font is the script font used, unless this option is specified.

The syntax of the font entries is:

fontn= typeface, [ size point-size, keyword, ...], [ script= scriptname ]
n An integer that specifies the font table entry.
typeface A valid typeface name, such as Times or Courier.
point-size The size of the font, in points. If you omit the point size, OpenEdge uses the default point size as defined by the typeface.
keyword You can specify the following keywords: bold, italic, underline, or strikeout.
scriptname By default, OpenEdge uses the script (character set) of the Windows FixedSys font for all fonts specified in the environment. If you select a different script when editing a font using the font common dialog, OpenEdge writes the specified script name to the font entry.

The tools used to capture the text and font metrics are tools/get-text-metrics.p and tools/get-font-metrics.p 4GL programs from the FWD project. They should be run on a Windows OS machine where OpenEdge is installed. Before getting to the usage, there are 2 steps to collecting all the inputs required.

1. Create font-list.txt
The font-list.txt file is a comma-delimited file used as input for both tools. The format is:
typeface name,point-size,bold-flag,italics-flag,underline-flag

Where:
  • typeface - Name as it appears in the artifacts collected above
  • point-size - As it appears, usually after size or size=. If it is a default, you will need to research a little to determine what the default size is. The converted project's p2j/src/font-metrics.xml includes several popular fonts. Use the implicit-size= value
  • bold-flag - True if this is bold attribute entry, false otherwise
  • italics-flag - True if this is italics attribute entry, false otherwise
  • underline-flag - True if this is underline attribute entry, false otherwise

For example, if you have in your font-table a font defined as MS Sans Serif, size=8, the entry in the font-list.txt file will be:

MS Sans Serif,8,false,false,false

If you want to capture metrics for all combinations of bold, italic, underline and for all font sizes, enter only the font name, per line, as in:

MS Sans Serif

Some points to consider for the font-list.txt:
  • Format the file without spaces between values and the delimiting commas.
  • Include all the entries.
  • Each font definition must appear only once in this file.
  • Don't include blank lines.
  • Order of the entries is not important. Feel free to put the entries in the order that makes the most sense.
  • Any entries that have "Script=symbol" will need to have symbolic entry in directory.xml.
  • It may be safe to drop a font from font-list.txt if it is not used for a label.

2. Copy ui_strings.txt

This file contains all the static text used in the converted project. It ends up in the root directory of the converted project.

Generate the Font and Text Metrics

For observation, the font and text metrics tools, written in 4GL are here:

It is best to use the tools that are included in your FWD project, and they should be run on the same configuration as the original Windows GUI application. Use the same cpstream, as well.

Copy the tools and the font-list.txt and ui_strings.txt files into a working folder. Run the tool from the command line using prowin32.exe -p <4GL tool>

Usage of get-font-metrics.p

FWD has built-in metrics for these fonts, for size 1 to 100 and all bold, italic and underline combinations:
  • Courier New
  • Microsoft Sans Serif
  • MS Sans Serif
  • Fixedsys
  • Segoe UI
  • Tahoma

If your application's font-table from progress.ini or another .ini file uses fonts other the ones specified above, you need to capture the legacy metrics of these fonts.

The tool prompts for two inputs:
  1. Enter the maximum font size (<= 1638): - this is the maximum font size for which metrics will be captured. If you do not specify an exact font size (i.e. use only font-name in font-list.txt), then metrics will be captured for all font sizes from 1 to the value you enter here (20 is the default), and all bold, italic, underline combinations.
  2. Enter the file name with the font list: - the default name is font-list.txt, you can adjust it or accept this value

The metrics will be captured in the font-metrics.xml file.

Usage of get-text-metrics.p

The tool will ask you for three inputs:
  1. Enter the maximum font size (<= 1638): - this is the maximum font size for which metrics will be captured. If you do not specify an exact font size (i.e. use only font-name in font-list.txt), then metrics will be captured for all font sizes from 1 to the value you enter here (20 is the default), and all bold, italic, underline combinations.
  2. Enter the file name with the font list: - the default name is font-list.txt, you can adjust it or accept this value
  3. Enter the file name with the text list: - change this to ui_strings.txt

Depending on the number of lines in ui_strings.txt, this tool might take a few minutes to complete. The metrics will be saved in the text-metrics.xml.

Merge to the Project

Once these tools have been run and the xml files created, they need to be copied into the src/ folder of your conversion project so the jar target can include them. Note that the clean step typically removes the src/ directory, so these should be excluded from that target. The font-metrics.xml should be renamed to font-metrics-ext.xml so it does not conflict with FWD's src/font-metrics.xml.

There is an additional attribute set to include at the top of the XML, and that is font-details. The Document Type Definition (DTD) can be found in FWD's src/font-metrics.dtd. This section will define the default size, and whether or not it is a fixed font. The font-details need to be at the beginning of the XML (the first children of font-list).

This is a sample src/font-metrics-ext.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE font-list SYSTEM "font-metrics.dtd">
<font-list>
   <font-details name="lucida console" implicit-size="10" />
   <font-details name="wingdings"      implicit-size="10" />

   <font name="Lucida Console" size="8"  bold="false" italic="false" underline="false" width="7" max-width="7" height="11"/>
   <font name="Lucida Console" size="10" bold="false" italic="false" underline="false" width="8" max-width="8" height="13"/>   
   <font name="Wingdings" size="12" bold="false" italic="false" underline="false" width="8" max-width="16" height="20"/>
   <font name="Wingdings" size="14" bold="false" italic="false" underline="false" width="8" max-width="51" height="22"/>
   <font name="Wingdings" size="16" bold="false" italic="false" underline="false" width="9" max-width="56" height="24"/>
   <font name="Wingdings" size="18" bold="false" italic="false" underline="false" width="12" max-width="24" height="29"/>
</font-list>

You only need to include those fonts which are not already in the font-metrics.xml, one entry for every distinct font name in the application's font-table.

Directory Setup

Within the directory.xml, there are two sections to edit:
  1. the font-table, which needs to have the exact font entries from the .ini file. The DefaultFont and DefaultFixedFont are in the startup section of the ini file. These need to be contained within the directory.xml, if they are different from the defaults. The keys in the font-table (like font0 in <node class="string" name="font0">) are the exact key from the font table in the .ini file.
  2. the custom-fonts, to specify the .ttf file for that font. The keys here (like font2 in <node class="container" name="font2">) are not related to the font-table. They just need to be unique keys in the custom-fonts section.

Font Usage

Linux or UNIX do not have the Windows legacy fonts upon which so much of the 4GL GUI layout and positioning is based. If you want the look of the application to match the Windows layout and positioning, the following font files need to be added to deploy/server/fonts/:

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

The files can be found on the original Windows system on which the application was run.

The directory is pre-configured to use these if the files are found (or if the client has them installed). If they are not found on the server or pre-installed on the client, then the FWD runtime code will pick its closest match and use that. Some screens will look different. The userid/password label text on the login screen is an example (it will be truncated if the fonts are not available).

License
You must have a license to the fonts to allow them to be used in this manner, since you are installing them on a system which does not otherwise have these fonts. If you do this, they will be used on every client that does not otherwise have these fonts locally installed at the operating system level. The font license would have to cover all of those use cases.

History

  • See #1794, #2701, #3842, #2747
  • what built-in replacements does FWD use, see #2675 and #3876-31
  • ui_strings.txt, capturing metrics/running tools/get-font-metrics.p and tools/get-text-metrics.p, configuring the results
    • Output is XML that goes into jar. See Eugenie for details
  • directory configuration, font overrides, how fonts get loaded/honored

For a background of Windows font typography, see https://docs.microsoft.com/en-us/typography/

Graphics Resources

Filesystem Paths and Names

absolute and/or windows-specific

Possenet

COM Automation Usage

Reports, Printing, Viewing and Saving Files

Email Usage

HWND Usage

Native API Usage

TBD: Copy the content from #4121-45 here, put it in a table form and update it to cover recent updates.

Child Process Launching

Windows Shell Usage

System Dialogs

INI Files

Registry Usage

.NET Usage

DOWN Frames, Redirected Terminal and Stream I/O

Help Files

Widget IDs


© 2004-2020 Golden Code Development Corporation. ALL RIGHTS RESERVED.

get-font-metrics.p Magnifier (9.34 KB) Roger Borrello, 03/18/2022 09:24 AM

get-text-metrics.p Magnifier (10.5 KB) Roger Borrello, 03/18/2022 09:24 AM