Lejocode has asked for the wisdom of the Perl Monks concerning the following question:
Hello again Monks, i have a problem with TTFMetrics giving me a wrong values for unicode strings.
here's an example:the output is:use warnings; use strict; use Font::TTFMetrics; use utf8; my $metrics = Font::TTFMetrics->new("Arial.ttf"); #16px my $str_en = ($metrics->string_width("Balha") * 1152) / (147456); my $str_ar = ($metrics->string_width("بلحة") +* 1152) / (147456); my $str_ar2 = ($metrics->string_width("\x{0628}\x{0644}\x{062D}\x{062 +9}") * 1152) / (147456); print ('My English string: ' . "$str_en" . "px\n"); print ('My Unicode string: ' . "$str_ar" . "px\n"); print ('My Unicode string 2: ' . "$str_ar2" . "px\n");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to get an accurate TTFMetrics values for unicode strings?
by vr (Curate) on Mar 09, 2017 at 18:35 UTC | |
by Lejocode (Novice) on Mar 09, 2017 at 21:01 UTC | |
by vr (Curate) on Mar 10, 2017 at 08:10 UTC | |
by Lejocode (Novice) on Mar 10, 2017 at 20:08 UTC | |
|
Re: How to get an accurate TTFMetrics values for unicode strings?
by Anonymous Monk on Mar 09, 2017 at 17:07 UTC | |
by Lejocode (Novice) on Mar 09, 2017 at 17:21 UTC |