Lines Matching defs:font
14 protected $font;
19 // default font data
20 $this->font = new stdClass();
21 $this->font->id = '';
22 $this->font->horizAdvX = 0;
23 $this->font->unitsPerEm = 0;
24 $this->font->ascent = 0;
25 $this->font->descent = 0;
26 $this->font->glyphs = [];
27 $this->font->size = 20;
28 $this->font->color = '';
29 $this->font->lineHeight = 1;
30 $this->font->letterSpacing = 0;
74 * Set font params (short-hand method)
87 * Set font size for display
93 $this->font->size = $size;
97 * Set font color
103 $this->font->color = $color;
113 $this->font->lineHeight = $value;
123 $this->font->letterSpacing = $value;
127 * Function takes path to SVG font (local path) and processes its xml
129 * font parameters
135 $this->font->glyphs = [];
144 if ($name == 'font') {
145 $this->font->id = $z->getAttribute('id');
146 $this->font->horizAdvX = $z->getAttribute('horiz-adv-x');
149 if ($name == 'font-face') {
150 $this->font->unitsPerEm = $z->getAttribute('units-per-em');
151 $this->font->ascent = $z->getAttribute('ascent');
152 $this->font->descent = $z->getAttribute('descent');
162 $this->font->glyphs[$unicode] = new stdClass();
163 $this->font->glyphs[$unicode]->horizAdvX = $z->getAttribute('horiz-adv-x');
164 if (empty($this->font->glyphs[$unicode]->horizAdvX)) {
165 $this->font->glyphs[$unicode]->horizAdvX = $this->font->horizAdvX;
167 $this->font->glyphs[$unicode]->d = $z->getAttribute('d');
171 $this->font->em = $this->font->glyphs[$unicode]->horizAdvX;
211 if ($this->font->color) {
212 $attributes['fill'] = $this->font->color;
228 $horizAdvY = $this->font->ascent + $this->font->descent;
229 $fontSize = (float) $this->font->size / $this->font->unitsPerEm;
239 $horizAdvY += $this->font->lineHeight * ($this->font->ascent + $this->font->descent);
244 $d = $this->font->glyphs[$letter]->d;
253 $horizAdvX += $this->font->glyphs[$letter]->horizAdvX * $fontSize +
254 $this->font->em * $this->font->letterSpacing * $fontSize;
266 $fontSize = (float) $this->font->size / $this->font->unitsPerEm;
270 $lineHeight = ($this->font->ascent + $this->font->descent) * $fontSize * 2;
282 $height += $lineHeight * $this->font->lineHeight;
287 $lineWidth += $this->font->glyphs[$letter]->horizAdvX * $fontSize +
288 $this->font->em * $this->font->letterSpacing * $fontSize;
305 $horizAdvY = $this->font->ascent + $this->font->descent;
306 $fontSize = (float) $this->font->size / $this->font->unitsPerEm;
309 $d = $this->font->glyphs[hexdec($unicode)]->d;
319 * Returns the character width, as set in the font file
332 if (!isset($this->font->glyphs[$letter])) {
336 $fontSize = (float) $this->font->size / $this->font->unitsPerEm;
337 return $this->font->glyphs[$letter]->horizAdvX * $fontSize;