Aftershock
Aftershock

Reputation: 5351

Is it possible to use unicode or utf8 to drawtext in WxDC?

I use WxPerl and I would like to draw unicode or utf8 text.

Is that possible?

Currently, i have something like this: $dc->DrawText( $linestr, $x, $y * $th ); but it seems to draw ascii like text only.

I found out that yes

$this->{Font} = Wx::Font->new( 10, wxMODERN, wxNORMAL, wxNORMAL );
$this->{Font}-> SetDefaultEncoding(wxFONTENCODING_UTF8); # error for this line see later
$dc->SetFont($this->{Font});

Unfortunately, I get an error Usage: Wx::Font::SetDefaultEncoding(encoding) at ........

Upvotes: 2

Views: 482

Answers (1)

Aftershock
Aftershock

Reputation: 5351

I found it out.

$this->{Font}-> SetDefaultEncoding(wxFONTENCODING_UTF8); needs to be $this->{Font}-> SetEncoding(wxFONTENCODING_UTF8); The name of the function changed in some of the versions.

Upvotes: 0

Related Questions