src/Thujohn/Pdf/dompdf/include/style.cls.php
function set_font($val) {
    $this->__font_size_calculated = false;
    //see __set and __get, on all assignments clear cache, not needed on direct set through __set
    $this->_prop_cache["font"] = null;
    $this->_props["font"] = $val;

    $important = isset($this->_important_props["font"]);

    if ( preg_match("/^(italic|oblique|normal)\s*(.*)$/i",$val,$match) ) {
      $this->_set_style("font_style", $match[1], $important);
      $val = $match[2];
    } else {
      $this->_set_style("font_style", self::$_defaults["font_style"], $important);
    }

    if ( preg_match("/^(small-caps|normal)\s*(.*)$/i",$val,$match) ) {
      $this->_set_style("font_variant", $match[1], $important);
      $val = $match[2];
    } else {
      $this->_set_style("font_variant", self::$_defaults["font_variant"], $important);
    }

    //matching numeric value followed by unit -> this is indeed a subsequent font size. Skip!
    if ( preg_match("/^(bold|bolder|lighter|100|200|300|400|500|600|700|800|900|normal)\s*(.*)$/i",$val,$match) &&
         !preg_match("/^(?:pt|px|pc|em|ex|in|cm|mm|%)/",$match[2])
       ) {
      $this->_set_style("font_weight", $match[1], $important);
      $val = $match[2];
    } else {
      $this->_set_style("font_weight", self::$_defaults["font_weight"], $important);
    }

    if ( preg_match("/^(xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger|\d+\s*(?:pt|px|pc|em|ex|in|cm|mm|%))\s*(.*)$/i",$val,$match) ) {
      $this->_set_style("font_size", $match[1], $important);
      $val = $match[2];
      if (preg_match("/^\/\s*(\d+\s*(?:pt|px|pc|em|ex|in|cm|mm|%))\s*(.*)$/i",$val,$match) ) {
        $this->_set_style("line_height", $match[1], $important);
        $val = $match[2];
      } else {
        $this->_set_style("line_height", self::$_defaults["line_height"], $important);
      }
    } else {
      $this->_set_style("font_size", self::$_defaults["font_size"], $important);
      $this->_set_style("line_height", self::$_defaults["line_height"], $important);
    }

    if(strlen($val) != 0) {
      $this->_set_style("font_family", $val, $important);
    } else {
      $this->_set_style("font_family", self::$_defaults["font_family"], $important);
    }
  }
function set_font($val) {
    $this->__font_size_calculated = false;
    //see __set and __get, on all assignments clear cache, not needed on direct set through __set
    $this->_prop_cache["font"] = null;
    $this->_props["font"] = $val;

    $important = isset($this->_important_props["font"]);

    if ( preg_match("/^(italic|oblique|normal)\s*(.*)$/i",$val,$match) ) {
      $this->_set_style("font_style", $match[1], $important);
      $val = $match[2];
    } else {
      $this->_set_style("font_style", self::$_defaults["font_style"], $important);
    }

    if ( preg_match("/^(small-caps|normal)\s*(.*)$/i",$val,$match) ) {
      $this->_set_style("font_variant", $match[1], $important);
      $val = $match[2];
    } else {
      $this->_set_style("font_variant", self::$_defaults["font_variant"], $important);
    }

    //matching numeric value followed by unit -> this is indeed a subsequent font size. Skip!
    if ( preg_match("/^(bold|bolder|lighter|100|200|300|400|500|600|700|800|900|normal)\s*(.*)$/i",$val,$match) &&
         !preg_match("/^(?:pt|px|pc|em|ex|in|cm|mm|%)/",$match[2])
       ) {
      $this->_set_style("font_weight", $match[1], $important);
      $val = $match[2];
    } else {
      $this->_set_style("font_weight", self::$_defaults["font_weight"], $important);
    }

    if ( preg_match("/^(xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger|\d+\s*(?:pt|px|pc|em|ex|in|cm|mm|%))\s*(.*)$/i",$val,$match) ) {
      $this->_set_style("font_size", $match[1], $important);
      $val = $match[2];
      if (preg_match("/^\/\s*(\d+\s*(?:pt|px|pc|em|ex|in|cm|mm|%))\s*(.*)$/i",$val,$match) ) {
        $this->_set_style("line_height", $match[1], $important);
        $val = $match[2];
      } else {
        $this->_set_style("line_height", self::$_defaults["line_height"], $important);
      }
    } else {
      $this->_set_style("font_size", self::$_defaults["font_size"], $important);
      $this->_set_style("line_height", self::$_defaults["line_height"], $important);
    }

    if(strlen($val) != 0) {
      $this->_set_style("font_family", $val, $important);
    } else {
      $this->_set_style("font_family", self::$_defaults["font_family"], $important);
    }
  }
function set_font ( $ val ) { $ this -> __font_size_calculated = false ; //see __set and __get, on all assignments clear cache, not needed on direct set through __set $ this -> _prop_cache [ "font" ] = null ; $ this -> _props [ "font" ] = $ val ; $ important = isset ( $ this -> _important_props [ "font" ] ) ; if ( preg_match ( "/^(italic|oblique|normal)\s*(.*)$/i" , $ val , $ match ) ) { $ this -> _set_style ( "font_style" , $ match [ 1 ] , $ important ) ; $ val = $ match [ 2 ] ; } else { $ this -> _set_style ( "font_style" , self :: $ _defaults [ "font_style" ] , $ important ) ; } if ( preg_match ( "/^(small-caps|normal)\s*(.*)$/i" , $ val , $ match ) ) { $ this -> _set_style ( "font_variant" , $ match [ 1 ] , $ important ) ; $ val = $ match [ 2 ] ; } else { $ this -> _set_style ( "font_variant" , self :: $ _defaults [ "font_variant" ] , $ important ) ; } //matching numeric value followed by unit -> this is indeed a subsequent font size. Skip! if ( preg_match ( "/^(bold|bolder|lighter|100|200|300|400|500|600|700|800|900|normal)\s*(.*)$/i" , $ val , $ match ) && ! preg_match ( "/^(?:pt|px|pc|em|ex|in|cm|mm|%)/" , $ match [ 2 ] ) ) { $ this -> _set_style ( "font_weight" , $ match [ 1 ] , $ important ) ; $ val = $ match [ 2 ] ; } else { $ this -> _set_style ( "font_weight" , self :: $ _defaults [ "font_weight" ] , $ important ) ; } if ( preg_match ( "/^(xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger|\d+\s*(?:pt|px|pc|em|ex|in|cm|mm|%))\s*(.*)$/i" , $ val , $ match ) ) { $ this -> _set_style ( "font_size" , $ match [ 1 ] , $ important ) ; $ val = $ match [ 2 ] ; if ( preg_match ( "/^\/\s*(\d+\s*(?:pt|px|pc|em|ex|in|cm|mm|%))\s*(.*)$/i" , $ val , $ match ) ) { $ this -> _set_style ( "line_height" , $ match [ 1 ] , $ important ) ; $ val = $ match [ 2 ] ; } else { $ this -> _set_style ( "line_height" , self :: $ _defaults [ "line_height" ] , $ important ) ; } } else { $ this -> _set_style ( "font_size" , self :: $ _defaults [ "font_size" ] , $ important ) ; $ this -> _set_style ( "line_height" , self :: $ _defaults [ "line_height" ] , $ important ) ; } if ( strlen ( $ val ) != 0 ) { $ this -> _set_style ( "font_family" , $ val , $ important ) ; } else { $ this -> _set_style ( "font_family" , self :: $ _defaults [ "font_family" ] , $ important ) ; } }
Sets the font style

combined attributes
set individual attributes also, respecting !important mark
exactly this order, separate by space. Multiple fonts separated by comma:
font-style, font-variant, font-weight, font-size, line-height, font-family

Other than with border and list, existing partial attributes should
reset when starting here, even when not mentioned.
If individual attribute is !important and explicite or implicite replacement is not,
keep individual attribute

require whitespace as delimiters for single value attributes
On delimiter "/" treat first as font height, second as line height
treat all remaining at the end of line as font
font-style, font-variant, font-weight, font-size, line-height, font-family

missing font-size and font-family might be not allowed, but accept it here and
use default (medium size, enpty font name)

@link http://www.w3.org/TR/CSS21/generate.html#propdef-list-style
@param $val
Sets the font style