20 $def =
$config->getCSSDefinition();
21 $this->info[
'font-style'] = $def->info[
'font-style'];
22 $this->info[
'font-variant'] = $def->info[
'font-variant'];
23 $this->info[
'font-weight'] = $def->info[
'font-weight'];
24 $this->info[
'font-size'] = $def->info[
'font-size'];
25 $this->info[
'line-height'] = $def->info[
'line-height'];
26 $this->info[
'font-family'] = $def->info[
'font-family'];
31 static $system_fonts = array(
35 'message-box' =>
true,
36 'small-caption' =>
true,
42 if ($string ===
'')
return false;
45 $lowercase_string = strtolower($string);
46 if (isset($system_fonts[$lowercase_string])) {
47 return $lowercase_string;
50 $bits = explode(
' ', $string);
53 $stage_1 = array(
'font-style',
'font-variant',
'font-weight');
56 for (
$i = 0, $size = count($bits);
$i < $size;
$i++) {
57 if ($bits[
$i] ===
'')
continue;
62 foreach ($stage_1 as $validator_name) {
63 if (isset($caught[$validator_name]))
continue;
64 $r = $this->info[$validator_name]->validate(
68 $caught[$validator_name] =
true;
73 if (count($caught) >= 3) $stage = 1;
74 if ($r !==
false)
break;
79 if (strpos($bits[
$i],
'/') !==
false) {
80 list($font_size, $line_height) =
81 explode(
'/', $bits[$i]);
82 if ($line_height ===
'') {
88 $font_size = $bits[
$i];
91 $r = $this->info[
'font-size']->validate(
96 if ($line_height ===
false) {
98 for (
$j = $i + 1;
$j < $size;
$j++) {
99 if ($bits[
$j] ===
'')
continue;
100 if ($bits[
$j] ===
'/') {
108 $line_height = $bits[
$j];
118 $r = $this->info[
'line-height']->validate(
119 $line_height,
$config, $context);
133 implode(
' ', array_slice($bits, $i, $size - $i));
134 $r = $this->info[
'font-family']->validate(
135 $font_family,
$config, $context);
139 return rtrim($final);