FIX: Microsoft VM Generates Spaces for "Accent" Style Characters When You Print Mangal Font


When you print the Mangal font, the Microsoft virtual machine (Microsoft VM) generates spaces wherever the special 'accent' style complex script characters are involved.


When you send the characters to the printer, the Microsoft VM computes the widths of the characters incorrectly.


To resolve this issue, install the latest version of the Microsoft VM. For more information, visit the following Microsoft Web site:WARNING: After you install the updated Microsoft VM, you cannot cannot uninstall it.

  • 3200-series Microsoft VM customers
    Upgrade to build 3316 or later.
  • 3300-series Microsoft VM customers
    Upgrade to build 3316 or later.


Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.


Steps to Reproduce Behavior

  1. Create the following Java applet called
    import java.applet.Applet;import java.awt.*;import*;public class testPrintingDevanagari extends Applet{    public void init() {        try {            PolicyEngine.assertPermission(PermissionID.PRINTING  );        } catch (Exception e) { }        Frame parentFrame = new Frame("Test printing devanagari script");        String testString1 = "\u0917\u0946\u0917\u0917\u0946\u0917";        String testString2 = "\u0915\u093F\u0915\u093F\u0915\u093F\u0915\u0915";        String testString3 = "\u0915\u094d\u0915\u0915\u094d\u0915";        Font hindiFont = new Font("Monospaced", Font.PLAIN, 24);            setFont(hindiFont);            Label label1 = new Label(testString1);        Label label2 = new Label(testString2);        Label label3 = new Label(testString3);            GridBagLayout gridBag = new GridBagLayout();        setLayout(gridBag);        GridBagConstraints c = new GridBagConstraints();        c.gridwidth = GridBagConstraints.REMAINDER;        c.fill = GridBagConstraints.HORIZONTAL;        gridBag.setConstraints(label1, c);        add(label1);        gridBag.setConstraints(label2, c);        add(label2);        gridBag.setConstraints(label3, c);        add(label3);        validate();        PrintJob pJob = parentFrame.getToolkit().getPrintJob(parentFrame, "Test printing devanagari script", null);        if (pJob != null) {            Graphics g = pJob.getGraphics();            g.setFont(hindiFont);            g.drawString(testString1, 150, 150);                    g.drawString(testString2, 150, 175);                    g.drawString(testString3, 150, 200);                    pJob.end();            g.dispose();        }setSize(430,270);    }}
  2. Type the following at the command prompt to generate the .class file:
  3. Cab and sign the testPrintingDevanagari applet as follows:
    cabarc n *.classsetreg 1 truemakecert -sk MyNewKey -n "CN=MyNewKey" MyNewCert.cercert2spc MyNewCert.cer MyNewCert.spcsigncode -j javasign.dll -jp Low -k MyNewKey -spc MyNewCert.spc
  4. Create an HTML file called testPrintingDevanagari.html with an <APPLET> tag that references the Java class:
    <HTML><HEAD><TITLE>Hindi-language printing test</TITLE></HEAD><BODY><APPLET CODE="testPrintingDevanagari.class" WIDTH=430 HEIGHT=270><PARAM NAME="cabbase" VALUE=""></APPLET></BODY></HTML>
  5. Install a font called Mangal.
  6. Create the following registry entry:
    My Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Java VM\Font
    Add the Mangal string value; this maps the monospaced Java font to the Mangal font.
  7. In Control Panel, double-click Regional Settings, and then click Indic.
  8. In Microsoft Internet Explorer, launch testPrintingDevanagari.html.


For support information about Visual J++ and the SDK for Java, visit the following Microsoft Web site:

Artikelnummer: 268786 – Letzte Überarbeitung: 14.02.2017 – Revision: 1