textcircle
(mPDF ≥ 5.4)
textcircle – Draw a circle using specified text
Description
<textcircle $r $top-text $bottom-text [ $divider ] [ $space-width ] [ $char-width ] [ $href ] />
Draw a circle using specified text. One or both of top-text and/or bottom-text must be defined. The radius and font-size are user-defined, whilst the width and height of the generated object will be calculated from these values.
Font-size should be set for <textcircle>
using in-line CSS or specified in a CSS stylesheet as for any standard
HTML tag. Other CSS styles supported on Circular Text are: border
, margin
, padding
, color
, background-color
, font-family
,
font-size
, font-weight
, font-style
, display
, visibility
and opacity
.
Note: CSS style are not inherited from parent elements.
From mPDF ≥ 5.6 the CSS property font-size
can be set to auto
. This automatically
sizes text to fill a semicircle (if both top and bottom set) or a full circle (if only one set).
Circular Text is displayed as though an in-line element. Automatic kerning will be applied to the text if
useKerning
is true
.
Note: Prior to mPDF 5.6 the textcircle was displayed with a white background. In ≥ 5.6 the background has been changed to transparent by default.
Parameters
- $r
-
Radius of circle. Any valid LENGTH can be entered
- $top-text
-
This parameter defines text which will be centred on the top of the circle.
$top-text cannot contain any of the characters:
<
,>
,&
,'
or"
and must use the appropriate HTML entities e.g.<textcircle top-text="Brian's document" />
. It is recommended that you usehtmlspecialchars('Content', ENT_QUOTES)
for this.Either top-text or bottom-text (or both) must be defined.
Default: BLANK
- $bottom-text
-
This parameter defines text which will be centred on the bottom of the circle.
$bottom-text cannot contain any of the characters:
<
,>
,&
,'
or"
and must use the appropriate HTML entities e.g.<textcircle bottom-text="Brian's document" />
. It is recommended that you usehtmlspecialchars('Content', ENT_QUOTES)
for this.Either top-text or bottom-text (or both) must be defined.
Default: BLANK
- $divider
-
This parameter defines an optional string of characters which will be used to divide top and bottom text of the circle.
$divider cannot contain any of the characters:
<
,>
,&
,'
or"
. Use HTML entities for special characters or non-ASCII characters e.g.<textcircle divider="•" />
Default: BLANK
- $space-width
-
This parameter should be specified as an integer defining the (fixed) letter-spacing as a percentage of normal.
Default:
'120'
- $char-width
-
This parameter should be specified as an integer defining the width of each character as a percentage of normal.
Default:
'100'
Changelog
Version | Description |
---|---|
5.4 | The tag was added. |
5.6 |
Transparent background fixed.
Support for divider added.
Support for |
Examples
<?php
...
$mpdf->WriteHTML('<textcircle r="30mm" space-width="120" char-width="150"
top-text="• Circular Text •" bottom-text="Circular Text"
style="background-color: #FFAAAA; border:1px solid red; padding: 0.3em; margin: 0.3em;
color: #000000; font-size: 21pt; font-weight:bold; font-family: Arial" />');
See Also
- CircularText() - PHP equivalent to
<textcircle>