You are here

private function CSSCompression_Individuals::fontweight in Advanced CSS/JS Aggregation 7

Same name and namespace in other branches
  1. 6 advagg_css_compress/css-compressor-3.x/src/lib/Individuals.inc \CSSCompression_Individuals::fontweight()

Converts font-weight names to numbers

Parameters

(string) val: font-weight prop value:

1 call to CSSCompression_Individuals::fontweight()
CSSCompression_Individuals::individuals in advagg_css_compress/css-compressor-3.x/src/lib/Individuals.inc
Runs special unit/directional compressions

File

advagg_css_compress/css-compressor-3.x/src/lib/Individuals.inc, line 205

Class

CSSCompression_Individuals
CSS Compressor [VERSION] [DATE] Corey Hart @ http://www.codenothing.com

Code

private function fontweight($val) {
  if (preg_match($this->rspace, $val)) {
    $parts = preg_split($this->rspace, $val);
    foreach ($parts as &$item) {
      $lower = strtolower($item);
      if (isset($this->weights[$lower]) && $lower != 'normal') {
        $item = $this->weights[$lower];
      }
    }
    $val = implode(' ', $parts);
  }
  else {
    if (isset($this->weights[strtolower($val)])) {
      $val = $this->weights[strtolower($val)];
    }
  }
  return $val;
}