?
Solved

Set Marathi font (Regional language) to PDF

Posted on 2011-03-11
14
Medium Priority
?
4,376 Views
Last Modified: 2012-05-11
I am using itext in my java application for pdf. I want to use Marathi font 'DVOTYogeshIL_N_Ship' which is ISM V6 font and it is true type & 'Open type' font (Unicode support UTF16) Marathi is a Indian Language.
I wrote code as,

FontFactory.register("C:/Windows/Fonts/DVOTYogeshIL_N_Ship.ttf", "DVOTYogeshIL_N_Ship");
Font tempFont = FontFactory.getFont("DVOTYogeshIL_N_Ship", BaseFont.CP1252, BaseFont.EMBEDDED);
System.out.println("tempFont = " + tempFont.getFamilyname());

but its not working. Please help
0
Comment
Question by:Aurii
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
14 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 35109137
Is this font file available for us to test?
0
 
LVL 92

Expert Comment

by:objects
ID: 35113484
looks ok
try this example to embed a font and let me know how it goes

One thing to check it that you are using the correct font encoding
0
 

Author Comment

by:Aurii
ID: 35114971
because of extension '.ttf' to font 'DVOTYogeshIL_N_Ship.ttf' its' not possible to attached font file. If possible please send me your mail ID for same.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 92

Expert Comment

by:objects
ID: 35114991
shouldn't be any need to see the font
did you try the code above?  did that embed the font ok?
0
 

Author Comment

by:Aurii
ID: 35115030
'Open type' font ( UTF16 support) Marathi (a Indian Language).
0
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 35115034
try changing the encoding to BaseFont.IDENTITY_H
0
 

Author Comment

by:Aurii
ID: 35115037
code is here....

         FontFactory.register("C:/Windows/Fonts/DVOTYogeshIL_N_Ship.ttf", "DVOTYogeshIL_N_Ship");

             
            Font tempFont = FontFactory.getFont("DVOTYogeshIL_N_Ship", BaseFont.CP1252,     BaseFont.EMBEDDED);
            System.out.println("tempFont="+tempFont.getFamilyname());
           
           
   PdfPCell cell = new PdfPCell(new Phrase("¿¿¿¿", FontFactory.getFont("DVOTYogeshIL_N_Ship", BaseFont.CP1257,  BaseFont.EMBEDDED, 24, Font.BOLD)));
           
0
 
LVL 92

Assisted Solution

by:objects
objects earned 500 total points
ID: 35115045
Font tempFont = FontFactory.getFont("DVOTYogeshIL_N_Ship", BaseFont.IDENTITY_H,     BaseFont.EMBEDDED);
System.out.println("tempFont="+tempFont.getFamilyname());
PdfPCell cell = new PdfPCell(new Phrase("¿¿¿¿", FontFactory.getFont("DVOTYogeshIL_N_Ship", BaseFont.IDENTITY_H,  BaseFont.EMBEDDED, 24, Font.BOLD)));
0
 

Author Comment

by:Aurii
ID: 35115768
"BaseFont.IDENTITY_H,"  It's not  working properly  ;sequence of alphabet has been change.
0
 
LVL 92

Expert Comment

by:objects
ID: 35118299
what result did you get when you run the code in the link I posted above?
0
 

Author Comment

by:Aurii
ID: 35145107
If I write " ¿¿¿¿ " through my code then in Pdf it prints wrong word. I have attached the Pdf where the Title is printed wrong instead of " ¿¿¿¿ " ..
bill1.pdf
0
 

Author Comment

by:Aurii
ID: 35145207
If I write " ¿¿¿¿ " through my code then in Pdf it prints wrong word. I have attached the Pdf where the Title is printed wrong instead of " ¿¿¿¿ " ..
0
 
LVL 92

Expert Comment

by:objects
ID: 35145256
can you explain exactly how it is wrong
0
 

Author Closing Comment

by:Aurii
ID: 35230744
The solution solved 20% of my problem. I solved my problem by me own
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question