Какой рейтинг вас больше интересует?
|
Главная /
Каталог блоговCтраница блогера Евгений Ламской/Записи в блоге |
Евгений Ламской
Голосов: 1 Адрес блога: http://lamskoy.livejournal.com/ Добавлен: 2010-05-18 17:01:15 |
|
Крик о помощи с Нибиру
2010-03-17 12:48:02 (читать в оригинале)Без комментариев :D
Mr. Freeman - Что стало с твоей мечтой?
2010-03-14 14:46:05 (читать в оригинале)Gentoo, Arch и шрифты
2010-03-14 14:43:37 (читать в оригинале)В догонку к посту: http://lamskoy.livejournal.com/3009.html
При конфиге шрифтов в посте, указанном выше, возникает проблема с битмап-шрифтами.
Если включен 70-no-bitmaps.conf, то такие чудные шрифты, как Terminus, становятся недоступными.
А если отключить его, то в Firefox многие растровые шрифты будут выглядеть чудовищно.
Лечится копированием настроек в /etc/fonts/local.conf (взято из Arch-евских конфигов шрифтов):
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/local.conf file to configure system font access -->
<fontconfig>
<match target="font">
<edit name="hinting" mode="assign"><bool>true</bool></edit>
<edit name="hintstyle" mode="assign"><const>hintslight</const></edit>
</match>
<!-- Replace generic bitmap font names by generic font families.
These font-families will get replaced by other rules and
default to scaled ones. -->
<match target="pattern" name="family">
<test name="family" qual="any">
<string>Helvetica</string>
</test>
<edit mode="assign" name="family">
<string>Arial</string>
<string>Liberation Sans</string>
<string>sans-serif</string>
</edit>
</match>
<match target="pattern" name="family">
<test name="family" qual="any">
<string>Courier</string>
</test>
<edit mode="assign" name="family">
<string>Courier New</string>
<string>Liberation Mono</string>
<string>monospace</string>
</edit>
</match>
<match target="pattern" name="family">
<test name="family" qual="any">
<string>Times</string>
</test>
<edit mode="assign" name="family">
<string>Times New Roman</string>
<string>Liberation Serif</string>
<string>serif</string>
</edit>
</match>
</fontconfig>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/local.conf file to configure system font access -->
<fontconfig>
<match target="font">
<edit name="hinting" mode="assign"><bool>true</bool></edit>
<edit name="hintstyle" mode="assign"><const>hintslight</const></edit>
</match>
<!-- Replace generic bitmap font names by generic font families.
These font-families will get replaced by other rules and
default to scaled ones. -->
<match target="pattern" name="family">
<test name="family" qual="any">
<string>Helvetica</string>
</test>
<edit mode="assign" name="family">
<string>Arial</string>
<string>Liberation Sans</string>
<string>sans-serif</string>
</edit>
</match>
<match target="pattern" name="family">
<test name="family" qual="any">
<string>Courier</string>
</test>
<edit mode="assign" name="family">
<string>Courier New</string>
<string>Liberation Mono</string>
<string>monospace</string>
</edit>
</match>
<match target="pattern" name="family">
<test name="family" qual="any">
<string>Times</string>
</test>
<edit mode="assign" name="family">
<string>Times New Roman</string>
<string>Liberation Serif</string>
<string>serif</string>
</edit>
</match>
</fontconfig>
Gentoo - сглаживание шрифтов
2010-01-24 19:40:14 (читать в оригинале)Сегодня расскажу как я настраивал сглаживание шрифтов в Gentoo Linux
Суть сводится к трем шагам:
1. Собрать пакеты cairo, libXft, fontconfig, freetype с примененными патчами для сглаживания (cleartype). В полной мере эти пакеты с патчами доступны в оверлее devnull, официальный репозиторий более консервативен.
2. Настроить fontconfig и поправить /etc/fonts/local.conf. В gentoo есть прекрасная утилита eselect, ей и будем производить манипуляции с настройками fontconfig
3. Перезапустить иксы
Теперь по порядку и детальнее:
1. Подключаем оверлей devnull
Если layman не установлен, устанавливаем:
emerge -av layman
Подключаем сам оверлей:
layman -a devnull
В /etc/make.conf добавляем:
PORTDIR_OVERLAY=""
source /usr/local/portage/layman/make.conf
source /usr/local/portage/layman/make.conf
2. Теперь необходимо размаскировать пакеты cairo, freetype, libXft, fontconfig.
Правим/создаем если не создан /etc/portage/package.keywords:
media-libs/fontconfig ~x86
x11-libs/cairo ~x86
media-libs/freetype ~x86
x11-libs/libXft ~x86
x11-libs/cairo ~x86
media-libs/freetype ~x86
x11-libs/libXft ~x86
Естественно, вместо x86 нужно указать свою архитектуру - amd64 например.
3. Устанавливаем USE-флаги для наших пакетов
Добавляем глобальный флаг cleartype:
euse -a cleartype
И локальные в /etc/portage/package.use:
media-libs/freetype bindist
4. Собираем пакеты:
emerge -avN cairo freetype libXft fontconfig
Запускаем etc-update после инсталляции пакетов и заменяем старые конфиги fontconfig на новые.
5. Настраиваем fontconfig.
Делаем eselect fontconfig list, смотрим какие конфиги подключены.
Чтобы включить субпиксельное сглаживание, необходимо выключить
(eselect fontconfig disable N, где N- номер конфига)
следующие конфиги:
10-no-sub-pixel.conf
10-unhinted.conf
10-unhinted.conf
и включить один из:
10-sub-pixel-bgr.conf
10-sub-pixel-rgb.conf
10-sub-pixel-vbgr.conf
10-sub-pixel-vrgb.conf
10-sub-pixel-rgb.conf
10-sub-pixel-vbgr.conf
10-sub-pixel-vrgb.conf
В большинстве случаев это 10-sub-pixel-rgb.conf
Ниже привожу свою конфигурацию fontconfig
Available fontconfig .conf files ( * is enabled ):
[1] 10-autohint.conf *
[2] 10-no-sub-pixel.conf
[3] 10-sub-pixel-bgr.conf
[4] 10-sub-pixel-rgb.conf *
[5] 10-sub-pixel-vbgr.conf
[6] 10-sub-pixel-vrgb.conf
[7] 10-unhinted.conf
[8] 20-fix-globaladvance.conf *
[9] 20-unhint-small-dejavu-sans.conf
[10] 20-unhint-small-dejavu-sans-mono.conf
[11] 20-unhint-small-dejavu-serif.conf
[12] 20-unhint-small-vera.conf *
[13] 25-unhint-nonlatin.conf
[14] 30-metric-aliases.conf *
[15] 30-urw-aliases.conf *
[16] 40-nonlatin.conf *
[17] 45-latin.conf *
[18] 49-sansserif.conf *
[19] 50-user.conf *
[20] 51-local.conf *
[21] 57-dejavu-sans.conf *
[22] 57-dejavu-sans-mono.conf *
[23] 57-dejavu-serif.conf *
[24] 60-latin.conf *
[25] 65-fonts-persian.conf *
[26] 65-khmer.conf
[27] 65-nonlatin.conf *
[28] 69-unifont.conf *
[29] 70-no-bitmaps.conf *
[30] 70-yes-bitmaps.conf
[31] 80-delicious.conf *
[32] 90-synthetic.conf *
[1] 10-autohint.conf *
[2] 10-no-sub-pixel.conf
[3] 10-sub-pixel-bgr.conf
[4] 10-sub-pixel-rgb.conf *
[5] 10-sub-pixel-vbgr.conf
[6] 10-sub-pixel-vrgb.conf
[7] 10-unhinted.conf
[8] 20-fix-globaladvance.conf *
[9] 20-unhint-small-dejavu-sans.conf
[10] 20-unhint-small-dejavu-sans-mono.conf
[11] 20-unhint-small-dejavu-serif.conf
[12] 20-unhint-small-vera.conf *
[13] 25-unhint-nonlatin.conf
[14] 30-metric-aliases.conf *
[15] 30-urw-aliases.conf *
[16] 40-nonlatin.conf *
[17] 45-latin.conf *
[18] 49-sansserif.conf *
[19] 50-user.conf *
[20] 51-local.conf *
[21] 57-dejavu-sans.conf *
[22] 57-dejavu-sans-mono.conf *
[23] 57-dejavu-serif.conf *
[24] 60-latin.conf *
[25] 65-fonts-persian.conf *
[26] 65-khmer.conf
[27] 65-nonlatin.conf *
[28] 69-unifont.conf *
[29] 70-no-bitmaps.conf *
[30] 70-yes-bitmaps.conf
[31] 80-delicious.conf *
[32] 90-synthetic.conf *
6. Настраиваем hinting.
Создаем/правим /etc/fonts/local.conf:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/local.conf file to configure system font access -->
<fontconfig>
<match target="font">
<edit name="hinting" mode="assign"><bool>true</bool></edit>
<edit name="hintstyle" mode="assign"><const>hintslight</const></edit>
</match>
</fontconfig>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/local.conf file to configure system font access -->
<fontconfig>
<match target="font">
<edit name="hinting" mode="assign"><bool>true</bool></edit>
<edit name="hintstyle" mode="assign"><const>hintslight</const></edit>
</match>
</fontconfig>
Параметр hintstyle можно выставить в hintslight, hintmedium, hintfull и поэкспериментировать - какой стиль хинтинга вам ближе по душе.
Мои предпочтения указаны выше :)
7. Перегружаем иксы и наслаждаемся красивым сглаживанием шрифтов :)
Распаковка архивов .t3x для TYPO3 CMS
2010-01-12 01:43:03 (читать в оригинале)Несколько лет назад я работал с TYPO3 CMS, сама система меня не впечатлила ни по скорости работы, ни по коду.
От комментариев насчет качества кода воздержусь, это не тема данного поста :)
Все расширения для данной CMS идут в архиве собственного формата .t3x - самописное подобие TAR-а + gzip сжатие.
Руками распаковывать очень неудобно, поэтому родился следующий скрипт:
static $instance = null;
protected static $instanceCalled = false;
private $errors = array();
protected function addError()
{
$this->errors[] = func_get_args();
}
protected function clearErrors()
{
$this->errors = array();
}
public function getErrors($clear = true)
{
$out = $this->errors;
if($clear) {
$this->clearErrors();
}
return $out;
}
public static function instance($classname = __CLASS__)
{
if(is_null(self::$instance)) {
self::$instanceCalled = true;
self::$instance = new $classname();
}
return self::$instance;
}
public function hook($handler="exception", $errorTypes = null)
{
if(is_null($errorTypes)) {
$errorTypes = E_ALL | E_STRICT;
}
$method = $handler.self::HANDLER_METHOD_SUFFIX;
$class = get_class($this);
if(!method_exists($this, $method)) {
throw new Exception("Method $class::$method doesn't exist");
}
set_error_handler(array($this, $method), $errorTypes);
}
public function unhook()
{
restore_error_handler();
}
public function exceptionHandler($errno, $errstr, $errfile, $errline)
{
$this->addError(func_get_args());
throw new Exception($errstr, $errno);
}
public function verboseHandler($errno, $errstr, $errfile, $errline)
{
$this->addError(func_get_args());
}
}
class Dir
{
public static function create($path, $mode = 0777, $recursive = true)
{
$path = self::normalize($path);
if(file_exists($path) && is_dir($path)) {
return;
}
mkdir($path, 0777, true);
}
public static function normalize($path)
{
$path = trim($path);
$path = rtrim($path, ".");
$path = str_replace(array("/","\\"), DIRECTORY_SEPARATOR, $path);
$path = rtrim($path, DIRECTORY_SEPARATOR);
return $path;
}
}
class Dumper
{
private $fileMode = "w";
public function setAppendMode($arg = true)
{
$this->fileMode = (bool) $arg ? "a" : "w";
}
public function varDump($data, $file)
{
ob_start();
var_dump($data);
$out = ob_get_contents();
ob_end_clean();
$this->writeToFile($out, $file);
}
public function writeToFile($data, $f)
{
$f = fopen($f, $this->fileMode);
if(!$f) {
throw new Exception("Cannot write to $f");
}
fwrite($f, $data);
fclose($f);
}
}
class TypoExtension
{
const HEADER_SIZE = 44;
private $isValid = false;
private $fileObj = null;
private $data = array();
public function __construct()
{
}
public function unpack($targetDir)
{
if(!isset($this->data['FILES'])) {
return;
}
$targetDir = Dir::normalize($targetDir);
foreach($this->data['FILES'] as $row) {
$dir = $targetDir.DIRECTORY_SEPARATOR.dirname($row['name']);
Dir::create($dir);
$file = Dir::normalize($targetDir.DIRECTORY_SEPARATOR.$row['name']);
file_put_contents($file, $row['content']);
}
}
public function read($file)
{
if(!file_exists($file)) {
throw new Exception("No such file: '{$file}'");
}
if(!is_readable($file)) {
throw new Exception("File is not readable: '{$file}'");
}
$f = @fopen($file, "r");
if(false === $f) {
throw new Exception("Cannot open file: '{$file}'");
}
$size = $fileSize = filesize($file);
if($fileSize < self::HEADER_SIZE) {
throw new Exception("Size of file should be > ".self::HEADER_SIZE.": '{$file}'");
}
$size -= self::HEADER_SIZE;
$head = fread($f, self::HEADER_SIZE);
/**
* Parse params
*/
$params = explode(":", $head, 3);
$gzencode = array_pop($params);
$gzencode = array_pop($params);
$fictiveCrc = array_pop($params);
if($gzencode !== 'gzcompress') {
throw new Exception("Invalid header found in file: '{$file}'");
}
$data = @fread($f, $size);
if(false === $data) {
throw new Exception("Cannot read data from file: '{$file}'");
}
$data = @gzuncompress ($data);
if(false === $data) {
throw new Exception("Invalid data (not gzcompressed) in file: '{$file}'");
}
$this->data = @unserialize($data);
if(unserialize(false) === $this->data) {
throw new Exception("Invalid data (gzcompressed, but not serialized) in file: '{$file}'");
}
return $this;
}
}
class __app
{
private static $singleton = null;
private $argc;
private $argv;
public function instance()
{
if(is_null(self::$singleton)) {
self::$singleton = new self();
}
return self::$singleton;
}
public function setArgs($argv, $argc)
{
$this->argc = (int) $argc;
$this->argv = (array) $argv;
}
public function checkArgs()
{
if(3 !== $this->argc) {
throw new Exception("Arguments should be: <file> <target>");
}
}
public function getArgs()
{
$this->checkArgs();
return array($this->argv[1], $this->argv[2]);
}
public function run($argv, $argc)
{
try {
$this->setArgs($argv, $argc);
list($file, $dir) = $this->getArgs();
$c = new TypoExtension();
$c->read($file)->unpack($dir);
} catch (Exception $e) {
printf("Error: %s\n", $e->getMessage());
exit(1);
}
print "OK\n";
exit(0);
}
}
if(empty($argv)) {
print "Not running from command line\n";
exit(0);
}
__app::instance()->run($argv, $argc);
?>
Категория «Размышления»
Взлеты Топ 5
+1561 |
1596 |
fiona |
+1550 |
1597 |
Алексей Чернов |
+1529 |
1559 |
Elen_i_rebyata |
+1513 |
1584 |
Малти_Ошер |
+1512 |
1589 |
Дрочливый_Драчун |
Падения Топ 5
-2 |
74 |
Рыжая_Лада |
-2 |
947 |
G-Traveler | Сайт заметок путешественника |
-2 |
1264 |
Сайт визажиста Мокровой Инны блог |
-5 |
53 |
BJohn |
-6 |
17 |
Аццкей_Сотона |
Популярные за сутки
Загрузка...
BlogRider.ru не имеет отношения к публикуемым в записях блогов материалам. Все записи
взяты из открытых общедоступных источников и являются собственностью их авторов.
взяты из открытых общедоступных источников и являются собственностью их авторов.