function units2pt($value, $font_size = null) { $units = substr($value, strlen($value) - 2, 2); switch ($units) { case "pt": return pt2pt((double) $value); case "px": return px2pt((double) $value); case "mm": return mm2pt((double) $value); case "cm": return mm2pt((double) $value * 10); // FIXME: check if it will work correcty in all situations (order of css rule application may vary). // FIXME: check if it will work correcty in all situations (order of css rule application may vary). case "em": if (is_null($font_size)) { $fs = get_font_size(); // $fs_parts = explode(" ", $fs); // if (count($fs_parts) == 2) { // return units2pt(((double)$value) * $fs_parts[0]*EM_KOEFF . $fs_parts[1]); // } else { return pt2pt((double) $value * $fs * EM_KOEFF); // }; } else { return $font_size * (double) $value * EM_KOEFF; } case "ex": if (is_null($font_size)) { $fs = get_font_size(); // $fs_parts = explode(" ", $fs); // if (count($fs_parts) == 2) { // return units2pt(((double)$value) * $fs_parts[0]*EX_KOEFF . $fs_parts[1]); // } else { return pt2pt((double) $value * $fs * EX_KOEFF); // }; } else { return $font_size * (double) $value * EX_KOEFF; } default: global $g_config; if ($g_config['mode'] === 'quirks') { return px2pt((double) $value); } else { return 0; } } }
function GenericBox() { $this->_left = 0; $this->_top = 0; $this->baseline = 0; $this->default_baseline = 0; // Generic CSS properties // Save CSS property values $base_font_size = get_base_font_size(); // 'color' $handler = get_css_handler('color'); $this->color = $handler->get(); // 'font-size' $this->font_size = units2pt(get_font_size(), $base_font_size); // 'font-family' $this->family = get_font_family(); // 'font-weight' $this->weight = get_font_weight(); // 'font-style' $this->style = get_font_style(); // 'text-decoration' $handler = get_css_handler('text-decoration'); $this->decoration = $handler->get(); }
function ps_set_font($encoding) { global $g_font_resolver; $data = get_font_size() . " " . $g_font_resolver->ps_font_family(get_font_family(), get_font_weight(), get_font_style(), $encoding); return $data; }
$len = strlen($map); $parts = strtolower(substr($phrase, 0, 2)); $offset = strpos($map, $parts[0]) * $len + strpos($map, $parts[1]); $hue = floor($offset / ($len * $len) * 360); $strcolor = "hsl({$hue}, 230, 110)"; $color = new ImagickPixel($strcolor); $image->colorizeImage($color, 1); return $hue; } $height = 1715; $width = 1715; $image = new Imagick('../images/radio-backdrop_1715.png'); $draw = new ImagickDraw(); $hue = tint_bg($image, $show); $draw->setFont('DejaVu-Sans-Bold'); $draw->setFontSize(get_font_size($show)); $draw->setStrokeColor("black"); $draw->setFillColor("white"); $draw->setStrokeWidth(6); //max(min(18 * (450 / $out_res), 30), 6)); $draw->setStrokeAntialias(true); $draw->setTextAntialias(true); list($parts, $height) = wordWrapAnnotation($image, $draw, $show, 1635); // If we only have one line then we can leave it centered. if (count($parts) > 1) { $draw->setTextAlignment(imagick::ALIGN_LEFT); $draw->setGravity(imagick::GRAVITY_NORTH); $ix = 0; $offset = 40; } else { $draw->setGravity(imagick::GRAVITY_CENTER);