Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
We wish to to understand why FcFontConfiguration overrides the getFontDiscriptors() method. Originally the implementation of this method was empty and then it was modified later on to return an empty fontDescriptors array. Understanding the reasons behind this will help us to validate our fix proposals (removing the overriding method). Under certain circumstances, postscript files generated by the AWT Printing API on Linux are significantly increased from 6u17 onwards (e.g. from a few KB to multiple MB). The problem also exists on Java 7. The reasons for the behaviour difference seem to be different in Java 6 vs Java 7. In Java 6, the addition of the Ubuntu fontconfig files in update 18 seems to have introduced this issue (CR 6551584 -subCR JDK-2178357). In Java 7 the execution flow is completely different. From our analysis of the code, the drawString method of PSPathGraphics class calls psPrinterJob.textOut and passes the string. If the textOut method was able to encode the string successfully it returns true, and the generated postscript file is of normal size. If psPrinterJob.textOut() returns false we call super.drawString() from PSPathGraphics, and this seems to cause the increase in the size of the postscript file. The psPrinterJob.textOut() call returns False when makeMultiCharsetString() returns NULL. In PlatformFont.java, the ComponentFonts array was NULL, hence the input String encoding was not successful. ComponentFonts is obtained by calling fontConfig.getFontDescriptors(familyName, style). In Java 7, fontConfig is FcFontConfiguration which has getFontDescriptors defined to return an empty FontDescriptor array.(Oracle bug id 6378099 and 6752622). In Java 6, fonfConfig is MFontConfiguration and it does not implement getFontDescriptors and calls FontConfiguration.getFontDescriptors() to obtain the font descriptors. When we remove the implementation of getFontDescriptors in FcFontConfiguration the size of the generated postscript file is normal. Originally FcFontConfiguration.getFontDescriptors() was not implemented. Perhaps the intention was to specify some functionality here at some point in the future, but it ended up being modified to return an empty font descriptor array under the fix for CR 6752622. We feel that either the implementation of FcFontConfiguration.getFontDescriptors() should be removed so that FontConfiguration.getFontDescriptors() is called instead. However, it is not clear what the original intentions were/are for FcFontConfiguration.getFontDescriptors().
|