Lines Matching refs:value
31 * @param int $value The length value string, e.g. '1cm'.
34 static public function stripDigits ($value) { argument
35 return ltrim ($value, '-.0123456789');
41 * @param string|int $value The length value string, e.g. '1cm'.
44 static public function getDigits ($value) { argument
46 $length = strlen ((string)$value);
48 if ( is_numeric ($value [$index]) === false &&
49 $value [$index] != '.' &&
50 $value [$index] != '-' ) {
53 $digits .= $value [$index];
71 * @param string|int $value The length value string, e.g. '1cm'.
74 static public function hasValidXSLUnit($value) { argument
75 return in_array(self::stripDigits((string)$value), self::$xsl_units);
81 * @param int $value The value to be set.
83 public function setPixelPerEm ($value) { argument
84 $this->px_per_em = $value;
99 * @param int $value The value to be set.
101 public function setTwipsPerPixelX ($value) { argument
102 $this->twips_per_pixel_x = $value;
108 * @param int $value The value to be set.
110 public function setTwipsPerPixelY ($value) { argument
111 $this->twips_per_pixel_y = $value;
140 $value = $pixel * $this->twips_per_pixel_x / self::$twips_per_point;
141 return round ($value, 2).'pt';
152 $value = $pixel * $this->twips_per_pixel_y / self::$twips_per_point;
153 return round ($value, 2).'pt';
159 * @param string $value String with length value, e.g. '20px', '20cm'...
164 public function toPoints ($value, $axis = 'y') { argument
165 $unit = self::stripDigits ($value);
167 return $value;
172 return $value;
175 $value = self::getDigits ($value);
178 $value = round (($value/self::$point_in_cm), 2).'pt';
181 $value = round (($value/(10 * self::$point_in_cm)), 2).'pt';
184 $value = round (($value * self::$inch_in_pt), 2).'pt';
187 $value = round (($value * self::$pc_in_pt), 2).'pt';
191 $value = $this->pixelToPointsX ($value);
193 $value = $this->pixelToPointsY ($value);
197 $value = $this->pixelToPointsY ($value * $this->getPixelPerEm());
200 return $value;
206 * @param string $value String with length value, e.g. '20px', '20pt'...
211 public function toCentimeters ($value, $axis = 'y') { argument
212 $unit = self::stripDigits ($value);
214 return $value;
219 return $value;
222 $value = self::toPoints ($value, $axis);
223 $value = substr($value, 0, -2);
224 $value = round (($value * self::$point_in_cm), 2).'cm';
225 return $value;
231 * @param string $value String with length value, e.g. '20pt'...
236 public function toPixel ($value, $axis = 'y') { argument
237 $unit = self::stripDigits ($value);
239 return $value;
244 return $value;
247 $value = self::toPoints ($value, $axis);
248 $value = substr($value, 0, -2);
250 $value = round ((($value*self::$twips_per_point)/$this->twips_per_pixel_x), 2).'px';
252 $value = round ((($value*self::$twips_per_point)/$this->twips_per_pixel_y), 2).'px';
254 return $value;
257 public function getAbsoluteValue ($value, $base) { argument
258 $unit = self::stripDigits ($value);
260 $value = self::getDigits ($value);
263 $value = ($value * $base)/100;
266 $value = $value * $base;
272 return $value;