Libharu D binding harud unicode support

Erdem via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Mar 1 10:38:47 PST 2017


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)


More information about the Digitalmars-d-learn mailing list