downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Imagick::queryFonts> <Imagick::quantizeImages
Last updated: Fri, 13 Nov 2009

view this page in

Imagick::queryFontMetrics

(PECL imagick 2.0.0)

Imagick::queryFontMetricsフォントメトリクスを表す配列を返す

説明

array Imagick::queryFontMetrics ( ImagickDraw $properties , string $text [, bool $multiline ] )
警告

この関数は、 現在のところ詳細な情報はありません。引数のリストのみが 記述されています。

フォントメトリクスを表す、多次元配列を返します。

パラメータ

properties

フォントのプロパティを含む ImagickDraw オブジェクト。

text

テキスト。

multiline

マルチラインパラメータ。空にすると自動検出します。

返り値

Imagick がサポートするフォーマットを含む配列を返します。 エラー時に ImagickException をスローします。

エラー / 例外

エラー時に ImagickException をスローします。

例1 Imagick::queryFontMetrics() の使用法

テキストのメトリクスを取得し、画面上に結果を表示します。

<?php
/* 新しい Imagick オブジェクトを作成します */
$im = new Imagick();

/* ImagickDraw オブジェクトを作成します */
$draw = new ImagickDraw();

/* フォントを設定します */
$draw->setFont('/path/to/font.ttf');

/* フォントメトリクスを出力します。複数行を自動検出します */
var_dump($im->queryFontMetrics($draw"Hello World!"));
?>



add a note add a note User Contributed Notes
Imagick::queryFontMetrics
Pete &#39;the Pete&#39; de Pijd
29-Jun-2009 01:18
You can also use $imagickDraw()->setTextAlignmnent(Imagick::ALIGN_CENTER) and $imagickDraw->annotation(..) instead.
waage
30-Jan-2008 03:57
You can use this to center a text within a box

<?php

$data
= "Hello world";

$text = new ImagickDraw();
$text->setFontSize(12);
$text->setFont("Arial");

$boxWidth = 210;

$im = new Imagick();

$fm = $im->queryFontMetrics($text, $data, false);

$textXLoc = ($boxWidth / 2) - ($fm["textWidth"] / 2);

?>

$textXLoc is now the starting location you need to use to feed to your annotateImage() function.

Imagick::queryFonts> <Imagick::quantizeImages
Last updated: Fri, 13 Nov 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites