Microsoft KB Archive/268786

= FIX: Microsoft VM Generates Spaces for &quot;Accent&quot; Style Characters When You Print Mangal Font =

Article ID: 268786

Article Last Modified on 6/14/2006

-

APPLIES TO


 * Microsoft Java Virtual Machine, when used with:
 * Microsoft Windows 2000 Standard Edition

-



This article was previously published under Q268786



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



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



RESOLUTION
To resolve this issue, install the latest version of the Microsoft VM. For more information, visit the following Microsoft Web site:

http://www.microsoft.com/mscorp/java/

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.



STATUS
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
  Create the following Java applet called testPrintingDevanagari.java: import java.applet.Applet; import java.awt.*; import com.ms.security.*;

public class testPrintingDevanagari extends Applet {   public void init { try { PolicyEngine.assertPermission(PermissionID.PRINTING ); } catch (Exception e) { }

Frame parentFrame = new Frame(&quot;Test printing devanagari script&quot;);

String testString1 = &quot;\u0917\u0946\u0917\u0917\u0946\u0917&quot;; String testString2 = &quot;\u0915\u093F\u0915\u093F\u0915\u093F\u0915\u0915&quot;; String testString3 = &quot;\u0915\u094d\u0915\u0915\u094d\u0915&quot;;

Font hindiFont = new Font(&quot;Monospaced&quot;, 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, &quot;Test printing devanagari script&quot;, 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); } }                    Type the following at the command prompt to generate the .class file:

jvc testPrintingDevanagari.java

  Cab and sign the testPrintingDevanagari applet as follows: cabarc n testprint.cab *.class setreg 1 true makecert -sk MyNewKey -n &quot;CN=MyNewKey&quot; MyNewCert.cer cert2spc MyNewCert.cer MyNewCert.spc signcode -j javasign.dll -jp Low -k MyNewKey -spc MyNewCert.spc testprint.cab   Create an HTML file called testPrintingDevanagari.html with an  tag that references the Java class:  <HEAD> <TITLE>Hindi-language printing test</TITLE> </HEAD> <BODY> <APPLET CODE=&quot;testPrintingDevanagari.class&quot; WIDTH=430 HEIGHT=270> <PARAM NAME=&quot;cabbase&quot; VALUE=&quot;testprint.cab&quot;> </APPLET> </BODY> </HTML> </li> Install a font called Mangal.</li> Create the following registry entry:

My Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Java VM\Font Alias\Courier

Add the Mangal string value; this maps the monospaced Java font to the Mangal font.</li> In Control Panel, double-click Regional Settings, and then click Indic.</li> In Microsoft Internet Explorer, launch testPrintingDevanagari.html.</li></ol>

<div class="references_section">