imagettftext

imagettftext and arabic language: how can I write in RTL mode?

≡放荡痞女 提交于 2021-02-08 10:01:49
问题 I need to write in RTL mode to imagettftext, 'caus arabic language is in this way: and I don't mean to revert the letters, I mean a css-like RTL (direction:rtl), so aligned-flag on the right... how can I? My easy code: require('static/I18N/Arabic.php'); $Arabic = new I18N_Arabic('Glyphs'); $font="static/ArabicModern-Light.ttf"; $testo=$Arabic->utf8Glyphs($testo); imagettftext($im, 26, 0, 560, 345, $textcolor, $font, "\"".$testo."\""); Thanks! 回答1: After eventually finding and downloading Ar

function imagettftext undefined on php 7.4

微笑、不失礼 提交于 2021-01-28 12:40:53
问题 how i can use imagettftext on php 7.4 I already build with configure ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-pgsql=/usr/local/psqllib --enable-soap --with-bz2 --with-curl --with-gettext --with-zlib --enable-ftp --enable-sockets --enable-cli --enable-opcache --with-mysqli --with-openssl --with-ldap --with-libdir=/lib64 --with-iconv --enable-mbstring --disable-mbregex --enable-gd --with-zip --with-freetype 来源: https://stackoverflow.com/questions/59889765/function

PHP imageftbbox imagettftext - simple letter spacing/kerning?

独自空忆成欢 提交于 2021-01-24 10:48:20
问题 Does anyone know a simple way to do letter spacing/kerning using imagettftext? I have my script working just as I need now, but I could really do with the generated text having the CSS style letter-spacing: -0.01em; so it matches the standard text on the page, but I don't see any way to do this easily. I did find the following thread relating to this, but I've tried to fit the answers into my code and none of them had the desired effect. php imagettftext letter spacing My current code is as

PHP - Creating image with imagettftext with Greek text

…衆ロ難τιáo~ 提交于 2019-12-24 17:53:37
问题 I'm trying to use imagettftext to create an image using this Greek text "από τον/την". This text is read from a MySQL database table from a field whose collation is set to utf8-unicode-ci. The text comes out of the database as "από τον/την". Here's the code (lifted from php.net) header('Content-Type: image/png'); // Create the image $im = imagecreatetruecolor(400, 30); // Create some colors $white = imagecolorallocate($im, 255, 255, 255); $grey = imagecolorallocate($im, 128, 128, 128

Missing chars in JpGraph

安稳与你 提交于 2019-12-24 07:42:14
问题 I have a web site that runs on Windows and uses cp1252 (aka Win-1252 ) so it can display Spanish characters. The app generates some plots with JpGraph 2.3 . These plots use the Tahoma Open Type font family to display text labels. Strings are provided in ANSI (i.e., cp1252) and font files support cp1252 (actually, the *.ttf files were copied from the system's font folder). It's been working fine in several setups from PHP/5.2.6 to PHP/5.3.0. Problems started when I ran the app under PHP/5.3.1

PHP imagettftext return bounding box differs from rendered bounding box

半城伤御伤魂 提交于 2019-12-24 03:16:34
问题 I'm using imagettftext to render a PNG file. A call to imagettftext() returns the bounding box that the text was rendered in, but on closer inspection, the text is being rendered slightly outside of it's own bounding box! The bounding box is correct (I inspected the pixel coords of the image), but the text location is incorrect, it outputs this, where the box is the returned bounding box after rendering the text: My code is: // helper function for geting textbox bounds function bounds($text,

PHP GD Text with Transparency/Alpha background

99封情书 提交于 2019-12-21 04:38:20
问题 alright so im having a problem with getting my text layed over a partly transparent image. i want the text to be solid, but i want part of the background of the image to be transparent, and the part the text is over to be solid, which i have, the problem is the text is inheriting the transparent background of one of the previous layers. here is the code, and an example of the output, and under that output what i want it to look like. the image is laying on a light grey background so the light

Accented characters not showing when using imagettftext with otf but showing with ttf

∥☆過路亽.° 提交于 2019-12-20 04:29:08
问题 I'm using imagettftext to generate images from OpenType files. Everything works until I try to use an accented character (e.g. å) or a character such as √. In their place I get the .notdef glyph. The fonts I'm using definitely have these characters. To make things even more frustrating, when I use a TTF everything works as expected. Any ideas? Thanks 回答1: Sorry to tell you, but PHP OTF supports only standard Ascii characters. It's a well known fact that special characters in OTF only very

Invalid font filename (imagettfbox)

早过忘川 提交于 2019-12-18 06:56:31
问题 This question has been asked over and over but I could not find the correct answer to my problem... As a little background note, all the code was working perfectly before we moved the class file from /application/lib/class to /library/class ... I have tried to play with GDFONTPATH, relative, absolute paths with and without the file extension to no avail. Here is some of the lines we have tried so far: putenv('GDFONTPATH=' . realpath(dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'fonts')); /

imagettftext(): calculate font size to ensure text fits image width

扶醉桌前 提交于 2019-12-17 19:54:21
问题 I'm using imagettftext() to write dynamic text on an image and I want it to fit my image width. How can I calculate the font size by the text lenght? 回答1: You can calculate the bounding box of TTF text before outputting it with the imagettfbbox function. Unfortunately there is no direct way of scaling to fit a width, so you'll have to do it yourself. One way of doing it is to pass the text with a default font size of, say 20, to imagettfbbox and retrieve the width from it. You can then