Print Page | Close Window

Printing Fractions and other unicode things

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2421
Printed Date: 11 May 25 at 7:07PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Printing Fractions and other unicode things
Posted By: fargburger
Subject: Printing Fractions and other unicode things
Date Posted: 02 Oct 12 at 5:22PM
How do I print these unicode superscript characters?

> http://www.alanwood.net/unicode/superscripts_and_subscripts.html

I can print superscript 1,2 and 3 because they're found in a lower range of codepoints, but I can't print the slash or the rest of the numbers for numerators or denominators.  In debugging, Delphi shows me 5/9ths up until I send the string off to QuickPDF. When it comes through in quick PDF I get nothing, it's not even considered in calculating the width of the text box.

I tried using embed and non-embeded true type fonts, other than that I don't do anything fancy to fonts in quickPDF.

(using QuickPDF 8.16)



Replies:
Posted By: AndrewC
Date Posted: 05 Oct 12 at 6:29AM
Not all fonts contain the extra fractions such as 1/6, 5/6.

If you only specify characters that exist then everything works as expected in 8.16 and 9.11.  To get the sample to work below in 8.16, 9.11 then just change the font to Arial Unicode MS.

I have used the following code for testing

Note :The string ends with  "1/4  1/2  3/4   1/3  2/3  1/8  3/8  5/8  7/8  1/5  2/5  3/5  4/5  1/6  5/6"

            QP.SetOrigin(1);
            string str = "12345: HELLO WORLD - ¼½¾ ⅓⅔⅛⅜⅝⅞  ⅕⅖⅗⅘⅙⅚";

            int id = QP.AddTrueTypeSubsettedFont("Arial", str, 0);

            QP.SelectFont(id);
            QP.SetTextSize(18);
            QP.DrawText(20, 30, str);

            QP.SaveToFile("out.pdf");

1. Using Arial I get the correct output up until 7/8.  The other characters don't exist in the font.

2. If I change the font to "Arial Unicode MS" then it generates the full string correctly.

Andrew.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk