You are here

protected function FontOperationTrait::getFontPath in Image Effects 8

Same name and namespace in other branches
  1. 8.3 src/Plugin/ImageToolkit/Operation/FontOperationTrait.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\FontOperationTrait::getFontPath()
  2. 8.2 src/Plugin/ImageToolkit/Operation/FontOperationTrait.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\FontOperationTrait::getFontPath()

Return the path of the font file.

Parameters

string $font_uri: The font URI.

Return value

string The local path of the font file.

3 calls to FontOperationTrait::getFontPath()
TextOverlay::execute in src/Plugin/ImageToolkit/Operation/gd/TextOverlay.php
Performs the actual manipulation on the image.
TextToWrapper::getTextHeightInfo in src/Plugin/ImageToolkit/Operation/gd/TextToWrapper.php
Return the height and basepoint of a text using TrueType fonts.
TextToWrapper::getTextWidth in src/Plugin/ImageToolkit/Operation/gd/TextToWrapper.php
Return the width of a text using TrueType fonts.

File

src/Plugin/ImageToolkit/Operation/FontOperationTrait.php, line 54

Class

FontOperationTrait
Base trait for image toolkit operations that require font handling.

Namespace

Drupal\image_effects\Plugin\ImageToolkit\Operation

Code

protected function getFontPath($font_uri) {
  if (!$font_uri) {
    throw new \InvalidArgumentException('Font file not specified');
  }
  if (!isset(static::$fontPaths[$font_uri])) {
    if (!($ret = $this
      ->getRealFontPath($font_uri))) {
      throw new \InvalidArgumentException("Could not find the font file {$font_uri}");
    }
    static::$fontPaths[$font_uri] = $ret;
  }
  return static::$fontPaths[$font_uri];
}