Browse Prior Art Database

A method of the Text-Plain format adjustment for multi-language

IP.com Disclosure Number: IPCOM000245317D
Publication Date: 2016-Feb-29
Document File: 4 page(s) / 91K

Publishing Venue

The IP.com Prior Art Database

Abstract

In many of the customer production environments, they usually use proportional fonts to show the multi language pure text report so as to resolve the problem of font display, such as "Unicode MS Arial". However, in terminal display, "Arial Unicode MS" is a proportional font, so that it will not display according to the static width relatively just as the monospaced font displays. In this case, we prompt a method to control the column width by adding blank spaces into the text. This method will constantly calcute the font that needs adjustment to determine how to load the text and add appropriate number of blank spaces to control the column width. The displaying text conent can be shown in good order by utilizing this method. This paper will focus on the Principle of realization for this method

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 54% of the total text.

Page 01 of 4

A method of the Text

A method of the Text-

--Plain format adjustment for multi Plain format adjustment for multi

Plain format adjustment for multi-

--language

language

This method will constantly calcute the font that needs adjustment to determine how to load the text and add appropriate number of blank spaces to control the column width. The displaying text conent can be shown in good order by utilizing this method. This paper will focus on the Principle of realization for this method

The formula we will use:

The result of this formula will return to current column, which means the number of blank spaces. We can see such key points as follow:
1. In the text report, the max width of each character during these multi-language string can be pre-defined.

2. The width of current char in the column should be pre-calculated.

3. Width of blank spaces also can be pre-calculated.

So, how to achieve above functions? We will introduce the details in the following content.

FontMetrics method:

Some existing methods already provide the function to measure characters' width, like method "stingWidth(String)" in class FontMetrics in JAVA API. But actually, this method has some limitation: the measurement result is not accurate. After repeated research, we designed a new method to amend it. The specific flow chart is as follows:

In many of the customer production environments, they usually use proportional fonts to show the multi language pure text report so as to resolve the problem of font display, such as "Unicode MS Arial". However, in terminal display, "Arial Unicode MS" is a proportional font, so that it will not display according to the static width relatively just as the monospaced font displays. Fig 1 gives an example for this situatioin. Then how to adjust the display format in proportional font? In this disclosure, we will prompt a method to control the column width by adding blank spaces into the text

1



Page 02 of 4

Its codes are as follows:

public static double strWidth(String str, Graphics g2, Font[] fontList) {

double strWidth=0;

if (fontList.length <= 0) { return strWidth;

}

int offset = 0;

int startIndex = 0;

String drawText;

while (startIndex < str.length()) {

offset = fontList[0].canDisplayUpT...