Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
 
3
class ValueFont {
4
  var $style;
5
  var $weight;
6
  var $size;
7
  var $family;
8
  var $line_height;
9
 
10
  function ValueFont() {
11
  }
12
 
13
  function &copy() {
14
    $font =& new ValueFont;
15
    $font->style  = $this->style;
16
    $font->weight = $this->weight;
17
 
18
    if ($this->size === CSS_PROPERTY_INHERIT) {
19
      $font->size = CSS_PROPERTY_INHERIT;
20
    } else {
21
      $font->size = $this->size->copy();
22
    };
23
 
24
    $font->family = $this->family;
25
 
26
    if ($this->line_height === CSS_PROPERTY_INHERIT) {
27
      $font->line_height = CSS_PROPERTY_INHERIT;
28
    } else {
29
      $font->line_height = $this->line_height->copy();
30
    };
31
 
32
    return $font;
33
  }
34
 
35
  function units2pt($base_font_size) {
36
    $this->size->units2pt($base_font_size);
37
    $this->line_height->units2pt($base_font_size);
38
  }
39
 
40
  function doInherit(&$state) {
41
    if ($state->get_propertyDefaultFlag(CSS_FONT_SIZE)) {
42
      $this->size = Value::fromData(1, UNIT_EM);
43
    };
44
 
45
    if ($this->style === CSS_PROPERTY_INHERIT) {
46
      $this->style = $state->getInheritedProperty(CSS_FONT_STYLE);
47
    };
48
 
49
    if ($this->weight === CSS_PROPERTY_INHERIT) {
50
      $this->weight = $state->getInheritedProperty(CSS_FONT_WEIGHT);
51
    };
52
 
53
    if ($this->size === CSS_PROPERTY_INHERIT) {
54
      $size = $state->getInheritedProperty(CSS_FONT_SIZE);
55
      $this->size = $size->copy();
56
    };
57
 
58
    if ($this->family === CSS_PROPERTY_INHERIT) {
59
      $this->family = $state->getInheritedProperty(CSS_FONT_FAMILY);
60
    };
61
 
62
    if ($this->line_height === CSS_PROPERTY_INHERIT) {
63
      $this->line_height = $state->getInheritedProperty(CSS_LINE_HEIGHT);
64
    };
65
  }
66
}
67
 
68
?>