www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Libharu D binding harud unicode support

reply Erdem <farukerdemoncel gmail.com> writes:
How should one use libharu d binding in unicode mode. Consider 
this basic example.

import std.stdio;

import harud;
import harud.c;

void main()
{
    void  errorCallback(uint error_number, uint detail_number)
    {
       writefln("err %x, %s, (num %x)"
             , error_number
             , getErrorDescription(error_number),
             detail_number);
    }

    Doc pdf = new Doc(&errorCallback);   ///  New pdf document
    Font helvetica = pdf.getFont("Helvetica");
    writeln("build font");

    Page page = pdf.addPage(); /// Add a new page to the document

    writeln("page width:", page.width);

    auto status = page.setFontAndSize(helvetica, 60);   /// Set 
the current font and size for the page
    writeln("set font width:", 60, " status", status);

    status = page.beginText(); /// Begin text mode
    writeln("begin ", status);

    status = page.showText("üçÇÜÖöĞğIı"); /// Print text to the 
page
    writeln("show ", status);

    page.endText(); /// End text mode

    pdf.saveToFile("./hello.pdf"); /// Write to disk
}

As you'd see I'd like to be able to write some Turkish characters 
to pdf file using libharu D binding.(a.k.a. harud)
Mar 01
parent Kagamin <spam here.lot> writes:
It looks like libharu or pdf don't support unicode well, see 
http://libharu.org/ so you probably need to select the turkish 
codepage and supply text in that encoding.
Mar 02