12768. Font name in FSDefineFont2, FSFontInfo[2] has trailing null.
The getName() method on FSDefineFont, FSFontInfo and FSFontInfow contains the trailing null used to terminate the string.
Root Cause
The specification for the font definition objects includes a fields that gives the length in bytes for the name of the font. This implies that there is no terminating null byte but in reality there is. As a result the decoding of the font name as a UTF-8 string also includes the terminating null.
Workaround?
There is no workaround however changing he source code is simple. In FSDefineFont2.java after line 855:
name = coder.readString(nameLength);
add the following code to strip off any trailing nulls:
while (name.charAt(name.length()-1) == 0) {
name = name.substring(0, name.length()-1);
}
Repeat the same step with FSFontInfo.java on line 408 and with FSFontInfo2.java on line 383.
When will it be fixed?
This was fixed in Transform 2.1.6 released on 31-Dec-2007