lundi 28 novembre 2016

AlivePdf embeded .otf

I need some specifics symbols from my pdf. If I use ttf+afm embeded fonts I need specify CodePage like 1251. And after convert some symbols (√, ²) displays like "?".

[Embed(source="/Klassy_obshchikh_komponentov/CreatePDF/alivepdf/fonts/embeded/ArialI.ttf", mimeType="application/octet-stream")]
    private var _fontTtf:Class;

    [Embed(source="/Klassy_obshchikh_komponentov/CreatePDF/alivepdf/fonts/embeded/ArialCyrMT-Italic.afm", mimeType="application/octet-stream")]
    private var _fontAfm:Class;

    pdfItem.setFont(new EmbeddedFont(new _fontTtf(), new _fontAfm(), CodePage.CP1251), textHeight*5);

pdfItem.addText (Convert(text), x, y);

    private function Convert(data:String):String 
    {
       var byteDataArray:ByteArray = new ByteArray();
       byteDataArray.writeMultiByte(data,"windows-1251"); 
       return byteDataArray.toString();
    }

I want use .otf font file and unicode. But I can not find how to do it. Anybody nows how to embed .otf font and use it without converting.

Aucun commentaire:

Enregistrer un commentaire