Commit fe5dfd2e authored by Victor Ananjevsky's avatar Victor Ananjevsky

add pfd utility

parent 16f28e71
......@@ -23,4 +23,5 @@ po/*.gmo
po/stamp-it
src/yad
src/yad-icon-browser
src/pfd
stamp-h1
......@@ -126,6 +126,18 @@ if test x$have_sourceview = xyes; then
AC_DEFINE([HAVE_SOURCEVIEW], [1], [Define this if you need GtkSourceView support])
fi
dnl pfd
AC_ARG_ENABLE([pfd],
[AS_HELP_STRING([--enable-pfd],
[Build pfd utility])],
[build_pfd=$enableval], [build_pfd=yes])
if test x$build_pfd = xyes; then
PKG_CHECK_MODULES([PFD], [pango], [build_pfd=yes], [build_pfd=no])
fi
AC_SUBST([PFD_CFLAGS])
AC_SUBST([PFD_LIBS])
AM_CONDITIONAL([BUILD_PFD], [test x$build_pfd = xyes])
dnl icon browser
AC_ARG_ENABLE([icon-browser],
[AS_HELP_STRING([--enable-icon-browser],
......@@ -177,5 +189,6 @@ echo " HTML widget - $have_html"
echo " Spell checking - $have_spell"
echo " GtkSourceView - $have_sourceview"
echo " GIO support - $have_gio"
echo " pfd - $build_pfd"
echo " Icon browser - $build_ib"
echo
......@@ -8,6 +8,9 @@ desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
endif
dist_man_MANS = yad.1
if BUILD_PFD
dist_man_MANS += pfd.1
endif
m4dir = $(datadir)/aclocal
m4_DATA = yad.m4
......
.TH PFD "1" "February 2019" "pfd" "User Commands"
.SH NAME
pfd \- convert font description between xft and pango formats
.SH SYNOPSIS
.B pfd
.RI [ OPTIONS ] FONT
.SH DESCRIPTION
\fBpfd\fR is a small command-line utility to transform font names from pango to xft specification and vice versa.
.SH OPTIONS
.TP
\fB\-x\fR, \fB\-\-xft\fR
Print font name in xft format. This is default.
.TP
\fB\-p\fR, \fB\-\-pango\fR
Print font name in pango format.
.TP
\fB\-h\fR, \fB\-\-help\fR
Print help.
.TP
\fB\-v\fR, \fB\-\-version\fR
Print current version.
......@@ -20,4 +20,5 @@ src/color.c
src/text.c
src/browser.c
src/notebook.c
src/pfd.c
data/yad-icon-browser.desktop.in
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: YAD\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-02-14 16:41+0200\n"
"POT-Creation-Date: 2019-02-23 13:44+0200\n"
"PO-Revision-Date: 2009-04-30 16:47+0300\n"
"Last-Translator: Victor Ananjevsky <ananasik@gmail.com>\n"
"Language-Team: \n"
......@@ -133,12 +133,12 @@ msgstr "Открыть URI"
msgid "Enter URI or file name:"
msgstr "Введите URI или имя файла:"
#: ../src/icons.c:368
#: ../src/icons.c:372
#, c-format
msgid "Unable to parse file %s: %s\n"
msgstr "Не могу разобрать файл %s: %s\n"
#: ../src/icons.c:385
#: ../src/icons.c:389
#, c-format
msgid "Unable to open directory %s: %s\n"
msgstr "Не могу открыть каталог %s: %s\n"
......@@ -158,22 +158,22 @@ msgstr "Не могу разобрать YAD_OPTIONS: %s\n"
msgid "Unable to parse command line: %s\n"
msgstr "Не удается разобрать командную строку: %s\n"
#: ../src/notification.c:119
#: ../src/notification.c:121
#, c-format
msgid "Could not load notification icon '%s': %s\n"
msgstr "Не удается загрузить иконку '%s': %s\n"
#: ../src/notification.c:297
#: ../src/notification.c:304
#, c-format
msgid "Invalid UTF-8 in tooltip!\n"
msgstr "Неверная последовательность UTF-8 в подсказке!\n"
#: ../src/notification.c:341
#: ../src/notification.c:348
#, c-format
msgid "Unknown command '%s'\n"
msgstr "Неизвестная команда '%s'\n"
#: ../src/notification.c:375
#: ../src/notification.c:382
msgid "Yad notification"
msgstr "Диалог уведомлений"
......@@ -1271,7 +1271,7 @@ msgstr "[ИМЯ]"
msgid "Show about dialog"
msgstr "Показать диалог 'О программе'"
#: ../src/option.c:643
#: ../src/option.c:643 ../src/pfd.c:84
msgid "Print version"
msgstr "Вывести версию"
......@@ -1394,223 +1394,223 @@ msgstr "Неизвестный сигнал: %s\n"
msgid "File exist. Overwrite?"
msgstr "Файл существует. Перезаписать?"
#: ../src/option.c:1702
#: ../src/option.c:1701
msgid "- Yet another dialoging program"
msgstr "- Программа для отображения диалогов"
#. Adds general option entries
#: ../src/option.c:1706
#: ../src/option.c:1705
msgid "General options"
msgstr "Основные параметры"
#: ../src/option.c:1706
#: ../src/option.c:1705
msgid "Show general options"
msgstr "Показывать основные параметры"
#. Adds common option entries
#: ../src/option.c:1712
#: ../src/option.c:1711
msgid "Common options"
msgstr "Общие параметры"
#: ../src/option.c:1712
#: ../src/option.c:1711
msgid "Show common options"
msgstr "Показывать общие параметры диалогов"
#. Adds calendar option entries
#: ../src/option.c:1718
#: ../src/option.c:1717
msgid "Calendar options"
msgstr "Параметры календаря"
#: ../src/option.c:1718
#: ../src/option.c:1717
msgid "Show calendar options"
msgstr "Показывать параметры календаря"
#. Adds color option entries
#: ../src/option.c:1724
#: ../src/option.c:1723
msgid "Color selection options"
msgstr "Параметры диалога выбора цвета"
#: ../src/option.c:1724
#: ../src/option.c:1723
msgid "Show color selection options"
msgstr "Показывать параметры диалога выбора цвета"
#. Adds dnd option entries
#: ../src/option.c:1730
#: ../src/option.c:1729
msgid "DND options"
msgstr "Параметры DND"
#: ../src/option.c:1730
#: ../src/option.c:1729
msgid "Show drag-n-drop options"
msgstr "Показывать параметры dnd"
#. Adds entry option entries
#: ../src/option.c:1736
#: ../src/option.c:1735
msgid "Text entry options"
msgstr "Параметры ввода текста"
#: ../src/option.c:1736
#: ../src/option.c:1735
msgid "Show text entry options"
msgstr "Показывать параметры ввода текста"
#. Adds file selection option entries
#: ../src/option.c:1742
#: ../src/option.c:1741
msgid "File selection options"
msgstr "Параметры диалога выбора файла"
#: ../src/option.c:1742
#: ../src/option.c:1741
msgid "Show file selection options"
msgstr "Показывать параметры диалога выбора файлов"
#. Add font selection option entries
#: ../src/option.c:1748
#: ../src/option.c:1747
msgid "Font selection options"
msgstr "Параметры диалога выбора шрифта"
#: ../src/option.c:1748
#: ../src/option.c:1747
msgid "Show font selection options"
msgstr "Показывать параметры диалога выбора шрифта"
#. Add form option entries
#: ../src/option.c:1754
#: ../src/option.c:1753
msgid "Form options"
msgstr "Параметры диалога формы"
#: ../src/option.c:1754
#: ../src/option.c:1753
msgid "Show form options"
msgstr "Показывать параметры диалога формы"
#. Add html options entries
#: ../src/option.c:1761
#: ../src/option.c:1760
msgid "HTML options"
msgstr "Параметры HTML диалога"
#: ../src/option.c:1761
#: ../src/option.c:1760
msgid "Show HTML options"
msgstr "Показывать параметры HTML диалога"
#. Add icons option entries
#: ../src/option.c:1768
#: ../src/option.c:1767
msgid "Icons box options"
msgstr "Параметры диалога значков"
#: ../src/option.c:1768
#: ../src/option.c:1767
msgid "Show icons box options"
msgstr "Показывать параметры диалога значков быстрого доступа"
#. Adds list option entries
#: ../src/option.c:1774
#: ../src/option.c:1773
msgid "List options"
msgstr "Параметры списка"
#: ../src/option.c:1774
#: ../src/option.c:1773
msgid "Show list options"
msgstr "Показывать параметры списка"
#. Adds multi progress option entries
#: ../src/option.c:1780
#: ../src/option.c:1779
msgid "Multi progress bars options"
msgstr "Параметры диалога с несколькими индикаторами"
#: ../src/option.c:1781
#: ../src/option.c:1780
msgid "Show multi progress bars options"
msgstr "Показывать параметры диалога с несколькими индикаторами"
#. Adds notebook option entries
#: ../src/option.c:1787
#: ../src/option.c:1786
msgid "Notebook options"
msgstr "Параметры диалога с вкладками"
#: ../src/option.c:1787
#: ../src/option.c:1786
msgid "Show notebook dialog options"
msgstr "Показывать параметры диалога с вкладками"
#. Adds notification option entries
#: ../src/option.c:1793
#: ../src/option.c:1792
msgid "Notification icon options"
msgstr "Параметры значка уведомления"
#: ../src/option.c:1794
#: ../src/option.c:1793
msgid "Show notification icon options"
msgstr "Показывать параметры значка уведомления"
#. Adds paned option entries
#: ../src/option.c:1800
#: ../src/option.c:1799
msgid "Paned dialog options"
msgstr "Параметры диалога с панелями"
#: ../src/option.c:1800
#: ../src/option.c:1799
msgid "Show paned dialog options"
msgstr "Показывать параметры диалога с панелями"
#. Adds picture option entries
#: ../src/option.c:1806
#: ../src/option.c:1805
msgid "Picture dialog options"
msgstr "Параметры диалога показа картинки"
#: ../src/option.c:1806
#: ../src/option.c:1805
msgid "Show picture dialog options"
msgstr "Показывать параметры диалога отображения картинки"
#. Adds print option entries
#: ../src/option.c:1812
#: ../src/option.c:1811
msgid "Print dialog options"
msgstr "Параметры диалога печати"
#: ../src/option.c:1812
#: ../src/option.c:1811
msgid "Show print dialog options"
msgstr "Показывать параметры диалога печати"
#. Adds progress option entries
#: ../src/option.c:1818
#: ../src/option.c:1817
msgid "Progress options"
msgstr "Параметры хода процесса"
#: ../src/option.c:1818
#: ../src/option.c:1817
msgid "Show progress options"
msgstr "Показывать параметры хода процесса"
#. Adds scale option entries
#: ../src/option.c:1824
#: ../src/option.c:1823
msgid "Scale options"
msgstr "Параметры масштаба"
#: ../src/option.c:1824
#: ../src/option.c:1823
msgid "Show scale options"
msgstr "Показывать параметры масштаба"
#. Adds text option entries
#: ../src/option.c:1830
#: ../src/option.c:1829
msgid "Text information options"
msgstr "Параметры текстовой информации"
#: ../src/option.c:1830
#: ../src/option.c:1829
msgid "Show text information options"
msgstr "Показывать параметры текстовой информации"
#. Adds sourceview option entries
#: ../src/option.c:1837
#: ../src/option.c:1836
msgid "SourceView options"
msgstr "Параметры SourceView"
#: ../src/option.c:1837
#: ../src/option.c:1836
msgid "Show SourceView options"
msgstr "Показывать параметры SourceView"
#. Adds file filters option entries
#: ../src/option.c:1844
#: ../src/option.c:1843
msgid "File filter options"
msgstr "Параметры фильтров диалога выбора файла"
#: ../src/option.c:1844
#: ../src/option.c:1843
msgid "Show file filter options"
msgstr "Показывать параметры фильтров диалога выбора файлов"
#. Adds miscellaneous option entries
#: ../src/option.c:1850
#: ../src/option.c:1849
msgid "Miscellaneous options"
msgstr "Дополнительные параметры"
#: ../src/option.c:1850
#: ../src/option.c:1849
msgid "Show miscellaneous options"
msgstr "Показывать дополнительные параметры"
......@@ -1746,6 +1746,37 @@ msgstr "Категория"
msgid "Icons"
msgstr "Иконки"
#: ../src/pfd.c:82
msgid "Print font name in xft format"
msgstr "Вывести шрифт в формате xft"
#: ../src/pfd.c:83
msgid "Print font name in pango format"
msgstr "Вывести шрифт в формате pango"
#: ../src/pfd.c:85
msgid "FONT"
msgstr "ШРИФТ"
#: ../src/pfd.c:104
msgid "- convert font description"
msgstr "- преобразование названий шрифтов"
#: ../src/pfd.c:108
#, c-format
msgid "option parsing failed: %s\n"
msgstr "сбой при разборе аргументов: %s\n"
#: ../src/pfd.c:120
#, c-format
msgid "no font specified\n"
msgstr "не задан шрифт.\n"
#: ../src/pfd.c:128
#, c-format
msgid "cannot get font description for for string \"%s\"\n"
msgstr "невозможно получить описание шрифта из строки \"%s\"\n"
#: ../data/yad-icon-browser.desktop.in.h:1
msgid "Icon Browser"
msgstr "Броузер иконок"
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: YAD\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-02-14 16:41+0200\n"
"POT-Creation-Date: 2019-02-23 13:44+0200\n"
"PO-Revision-Date: 2009-04-30 16:47+0300\n"
"Last-Translator: Victor Ananjevsky <ananasik@gmail.com>\n"
"Language-Team: \n"
......@@ -133,12 +133,12 @@ msgstr "Відкрити URI"
msgid "Enter URI or file name:"
msgstr "Введіть URI або ім'я файлу:"
#: ../src/icons.c:368
#: ../src/icons.c:372
#, c-format
msgid "Unable to parse file %s: %s\n"
msgstr "Не можу розібрати файл %s: %s\n"
#: ../src/icons.c:385
#: ../src/icons.c:389
#, c-format
msgid "Unable to open directory %s: %s\n"
msgstr "Не можу відкрити каталог %s: %s\n"
......@@ -158,22 +158,22 @@ msgstr "Не можу розібрати YAD_OPTIONS: %s\n"
msgid "Unable to parse command line: %s\n"
msgstr "Не вдається розібрати командний рядок: %s\n"
#: ../src/notification.c:119
#: ../src/notification.c:121
#, c-format
msgid "Could not load notification icon '%s': %s\n"
msgstr "Не вдається завантажити іконку '%s': %s\n"
#: ../src/notification.c:297
#: ../src/notification.c:304
#, c-format
msgid "Invalid UTF-8 in tooltip!\n"
msgstr "Неправильна послідовність UTF-8 у підказці!\n"
#: ../src/notification.c:341
#: ../src/notification.c:348
#, c-format
msgid "Unknown command '%s'\n"
msgstr "Невідома команда '%s'\n"
#: ../src/notification.c:375
#: ../src/notification.c:382
msgid "Yad notification"
msgstr "Діалог повідомлень"
......@@ -1276,7 +1276,7 @@ msgstr "[ІМ'Я]"
msgid "Show about dialog"
msgstr "Показати діалог 'Про програму'"
#: ../src/option.c:643
#: ../src/option.c:643 ../src/pfd.c:84
msgid "Print version"
msgstr "Вивести версію"
......@@ -1399,223 +1399,223 @@ msgstr "Невідомий сигнал: %s\n"
msgid "File exist. Overwrite?"
msgstr "Файл існує. Перезаписати?"
#: ../src/option.c:1702
#: ../src/option.c:1701
msgid "- Yet another dialoging program"
msgstr "- Програма для відображення діалогів"
#. Adds general option entries
#: ../src/option.c:1706
#: ../src/option.c:1705
msgid "General options"
msgstr "Основні параметри"
#: ../src/option.c:1706
#: ../src/option.c:1705
msgid "Show general options"
msgstr "Показувати основні параметри"
#. Adds common option entries
#: ../src/option.c:1712
#: ../src/option.c:1711
msgid "Common options"
msgstr "Загальні параметри"
#: ../src/option.c:1712
#: ../src/option.c:1711
msgid "Show common options"
msgstr "Показувати загальні параметри діалогів"
#. Adds calendar option entries
#: ../src/option.c:1718
#: ../src/option.c:1717
msgid "Calendar options"
msgstr "Параметри календаря"
#: ../src/option.c:1718
#: ../src/option.c:1717
msgid "Show calendar options"
msgstr "Показувати параметри календаря"
#. Adds color option entries
#: ../src/option.c:1724
#: ../src/option.c:1723
msgid "Color selection options"
msgstr "Параметри діалогу вибору кольору"
#: ../src/option.c:1724
#: ../src/option.c:1723
msgid "Show color selection options"
msgstr "Показувати параметри діалогу вибору кольору"
#. Adds dnd option entries
#: ../src/option.c:1730
#: ../src/option.c:1729
msgid "DND options"
msgstr "Параметри DND"
#: ../src/option.c:1730
#: ../src/option.c:1729
msgid "Show drag-n-drop options"
msgstr "Показувати параметри dnd"
#. Adds entry option entries
#: ../src/option.c:1736
#: ../src/option.c:1735
msgid "Text entry options"
msgstr "Параметри вводу тексту"
#: ../src/option.c:1736
#: ../src/option.c:1735
msgid "Show text entry options"
msgstr "Показувати параметри вводу тексту"
#. Adds file selection option entries
#: ../src/option.c:1742
#: ../src/option.c:1741
msgid "File selection options"
msgstr "Параметри діалогу вибору файлів"
#: ../src/option.c:1742
#: ../src/option.c:1741
msgid "Show file selection options"
msgstr "Показувати параметри діалогу вибору файлів"
#. Add font selection option entries
#: ../src/option.c:1748
#: ../src/option.c:1747
msgid "Font selection options"
msgstr "Параметри діалогу вибору шрифту"
#: ../src/option.c:1748
#: ../src/option.c:1747
msgid "Show font selection options"
msgstr "Показувати параметри діалоги вибору шрифту"
#. Add form option entries
#: ../src/option.c:1754
#: ../src/option.c:1753
msgid "Form options"
msgstr "Параметри діалогу форми"
#: ../src/option.c:1754
#: ../src/option.c:1753
msgid "Show form options"
msgstr "Показувати параметри діалогу форми"
#. Add html options entries
#: ../src/option.c:1761
#: ../src/option.c:1760
msgid "HTML options"
msgstr "Параметри HTML діалогу"
#: ../src/option.c:1761
#: ../src/option.c:1760
msgid "Show HTML options"
msgstr "Показувати параметри HTML діалогу"
#. Add icons option entries
#: ../src/option.c:1768
#: ../src/option.c:1767
msgid "Icons box options"
msgstr "Параметри діалогу іконок"
#: ../src/option.c:1768
#: ../src/option.c:1767
msgid "Show icons box options"
msgstr "Показувати параметри діалогу іконок швидкого доступу"
#. Adds list option entries
#: ../src/option.c:1774
#: ../src/option.c:1773
msgid "List options"
msgstr "Параметри списку"
#: ../src/option.c:1774
#: ../src/option.c:1773
msgid "Show list options"
msgstr "Показувати параметри списку"
#. Adds multi progress option entries
#: ../src/option.c:1780
#: ../src/option.c:1779
msgid "Multi progress bars options"
msgstr "Параметри діалогу з декількома індикаторами"
#: ../src/option.c:1781
#: ../src/option.c:1780
msgid "Show multi progress bars options"
msgstr "Показувати параметри діалогу з декількома індикаторами"
#. Adds notebook option entries
#: ../src/option.c:1787
#: ../src/option.c:1786
msgid "Notebook options"
msgstr "Параметри діалогу з вкладками"
#: ../src/option.c:1787
#: ../src/option.c:1786
msgid "Show notebook dialog options"
msgstr "Показувати параметри діалогу з вкладками"
#. Adds notification option entries
#: ../src/option.c:1793
#: ../src/option.c:1792
msgid "Notification icon options"
msgstr "Параметри іконки повідомлень"
#: ../src/option.c:1794
#: ../src/option.c:1793
msgid "Show notification icon options"
msgstr "Показувати параметри іконки повідомлень"
#. Adds paned option entries
#: ../src/option.c:1800
#: ../src/option.c:1799
msgid "Paned dialog options"
msgstr "Параметри діалогу з панелями"
#: ../src/option.c:1800
#: ../src/option.c:1799
msgid "Show paned dialog options"
msgstr "Показувати параметри діалогу з панелями"
#. Adds picture option entries
#: ../src/option.c:1806
#: ../src/option.c:1805
msgid "Picture dialog options"
msgstr "Параметри діалогу з картинкою"
#: ../src/option.c:1806
#: ../src/option.c:1805
msgid "Show picture dialog options"
msgstr "Показувати параметри діалогу відображення картинки"
#. Adds print option entries
#: ../src/option.c:1812
#: ../src/option.c:1811
msgid "Print dialog options"
msgstr "Параметри діалогу друку"
#: ../src/option.c:1812
#: ../src/option.c:1811
msgid "Show print dialog options"
msgstr "Показувати параметри діалогу друку"
#. Adds progress option entries
#: ../src/option.c:1818
#: ../src/option.c:1817
msgid "Progress options"
msgstr "Параметри прогресу"
#: ../src/option.c:1818
#: ../src/option.c:1817
msgid "Show progress options"
msgstr "Показувати параметри прогресу"
#. Adds scale option entries
#: ../src/option.c:1824
#: ../src/option.c:1823
msgid "Scale options"
msgstr "Параметри масштабу"
#: ../src/option.c:1824
#: ../src/option.c:1823
msgid "Show scale options"
msgstr "Показувати параметри масштабу"
#. Adds text option entries
#: ../src/option.c:1830
#: ../src/option.c:1829
msgid "Text information options"
msgstr "Параметри текстової інформації"
#: ../src/option.c:1830
#: ../src/option.c:1829
msgid "Show text information options"
msgstr "Показувати параметри текстової інформації"
#. Adds sourceview option entries
#: ../src/option.c:1837
#: ../src/option.c:1836
msgid "SourceView options"
msgstr "Параметри SourceView"
#: ../src/option.c:1837
#: ../src/option.c:1836
msgid "Show SourceView options"
msgstr "Показувати параметри SourceView"
#. Adds file filters option entries
#: ../src/option.c:1844
#: ../src/option.c:1843
msgid "File filter options"
msgstr "Параметри фільтрів для діалогу вибору файлів"
#: ../src/option.c:1844
#: ../src/option.c:1843
msgid "Show file filter options"
msgstr "Показувати параметри фільтрів для діалогу вибору файлів"
#. Adds miscellaneous option entries
#: ../src/option.c:1850
#: ../src/option.c:1849
msgid "Miscellaneous options"
msgstr "Додаткові параметри"
#: ../src/option.c:1850
#: ../src/option.c:1849
msgid "Show miscellaneous options"
msgstr "Показувати додаткові параметри"
......@@ -1751,6 +1751,37 @@ msgstr "Категорія"
msgid "Icons"
msgstr "Іконки"
#: ../src/pfd.c:82
msgid "Print font name in xft format"
msgstr "Вивести назву шрифта у форматі xft"
#: ../src/pfd.c:83
msgid "Print font name in pango format"
msgstr "Вивести назву шрифта у форматі pango"
#: ../src/pfd.c:85
msgid "FONT"
msgstr "НАЗВА_ШРИФТУ"
#: ../src/pfd.c:104
msgid "- convert font description"
msgstr "- конвертація описа шрифта"
#: ../src/pfd.c:108
#, c-format
msgid "option parsing failed: %s\n"
msgstr "збій при розборі аргументів: %s\n"
#: ../src/pfd.c:120
#, c-format
msgid "no font specified\n"
msgstr "шрифт не вказано.\n"
#: ../src/pfd.c:128
#, c-format
msgid "cannot get font description for for string \"%s\"\n"
msgstr "неможливо отримати опис шрифта зі стрічки \"%s\"\n"
#: ../data/yad-icon-browser.desktop.in.h:1
msgid "Icon Browser"
msgstr "Павігатор іконок"
......@@ -1758,6 +1789,3 @@ msgstr "Павігатор іконок"
#: ../data/yad-icon-browser.desktop.in.h:2
msgid "Inspect GTK Icon Theme"
msgstr "Перегляд теми іконок GTK"
#~ msgid "Use #rrrrggggbbbb format instead of #rrggbb"
#~ msgstr "Використовувати формат #rrrrggggbbbb замість #rrggbb"
......@@ -37,6 +37,14 @@ endif
yad_CFLAGS = $(GTK_CFLAGS) $(HTML_CFLAGS) $(SPELL_CFLAGS) $(SOURCEVIEW_CFLAGS)
yad_LDADD = $(GTK_LIBS) $(HTML_LIBS) $(SPELL_LIBS) $(SOURCEVIEW_LIBS)
if BUILD_PFD
bin_PROGRAMS += pfd
pfd_SOURCES = pfd.c
pfd_CFLAGS = $(PFD_CFLAGS)
pfd_LDADD = $(PFD_LIBS)
endif
if BUILD_IB
bin_PROGRAMS += yad-icon-browser
......
/*
* This file is part of YAD.
*
* YAD is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* YAD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with YAD. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright (C) 2019, Victor Ananjevsky <ananasik@gmail.com>
*/
#include <config.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <pango/pango.h>
typedef enum {
PANGO_SPEC,
XFT_SPEC
} FontType;
static FontType font_type = XFT_SPEC;
static gboolean
set_type (const gchar *name, const gchar *val, gpointer d, GError **err)
{
gint i = 1;
if (name[i] == '-')
i = 2;
if (name[i] == 'p')
font_type = PANGO_SPEC;
else if (name[i] == 'x')
font_type = XFT_SPEC;
else
return FALSE;
return TRUE;
}
static gchar *
parse_font (gchar *fn)
{
gchar **fnt;
gint i = 1;
GString *pfd = g_string_new (NULL);
fnt = g_strsplit (fn, ":", -1);
if (g_ascii_strcasecmp (fnt[0], "xft") != 0)
return fnt[0];
while (fnt[i])
{
if (g_ascii_strncasecmp (fnt[i], "style=", 6) == 0)
g_string_append_printf (pfd, "%s ", fnt[i] + 6);
else if (g_ascii_strncasecmp (fnt[i], "size=", 5) == 0)
g_string_append_printf (pfd, "%s ", fnt[i] + 5);
else if (g_ascii_strncasecmp (fnt[i], "pixelsize=", 10) == 0)
g_string_append_printf (pfd, "%spx ", fnt[i] + 10);
else
g_string_append_printf (pfd, "%s ", fnt[i]);
i++;
}
return pfd->str;
}
static gchar **fonts = NULL;
static gboolean ver = FALSE;
static GOptionEntry ents[] = {
{ "xft", 'x', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, set_type, N_("Print font name in xft format"), NULL },
{ "pango", 'p', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, set_type, N_("Print font name in pango format"), NULL },
{ "version", 'v', 0, G_OPTION_ARG_NONE, &ver, N_("Print version"), NULL },
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &fonts, 0, N_("FONT") },
{ NULL }
};
int
main (int argc, char *argv[])
{
GOptionContext *ctx;
GError *err = NULL;
PangoFontDescription *fnd = NULL;
setlocale (LC_ALL, "");
#ifdef ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
#endif
ctx = g_option_context_new (_("- convert font description"));
g_option_context_add_main_entries (ctx, ents, GETTEXT_PACKAGE);
if (!g_option_context_parse (ctx, &argc, &argv, &err))
{
g_printerr (_("option parsing failed: %s\n"), err->message);
return 1;
}
if (ver)
{
g_print ("%s\n", VERSION);
return 0;
}
if (!fonts || !fonts[0])
{
g_printerr (_("no font specified\n"));
return 1;
}
/* parse font */
fnd = pango_font_description_from_string (parse_font (fonts[0]));
if (!fnd)
{
g_printerr (_("cannot get font description for for string \"%s\"\n"), fonts[0]);
return 1;
}
/* print font */
switch (font_type)
{
case PANGO_SPEC:
g_print ("%s\n", pango_font_description_to_string (fnd));
break;
case XFT_SPEC:
{
PangoFontMask mask = pango_font_description_get_set_fields (fnd);
if (mask & PANGO_FONT_MASK_FAMILY)
g_print ("xft:%s", pango_font_description_get_family (fnd));
else
g_print ("xft:Sans"); /* simple default */
if (mask & PANGO_FONT_MASK_WEIGHT)
{
switch (pango_font_description_get_weight (fnd))
{
case PANGO_WEIGHT_THIN:
g_print (":Thin");
break;
case PANGO_WEIGHT_ULTRALIGHT:
g_print (":Ultralight");
break;
case PANGO_WEIGHT_LIGHT:
g_print (":Light");
break;
case PANGO_WEIGHT_SEMILIGHT:
g_print (":Semilight");
break;
case PANGO_WEIGHT_BOOK:
g_print (":Book");
break;
case PANGO_WEIGHT_NORMAL:
break;
case PANGO_WEIGHT_MEDIUM:
g_print (":Medium");
break;
case PANGO_WEIGHT_SEMIBOLD:
g_print (":Semibold");
break;
case PANGO_WEIGHT_BOLD:
g_print (":Bold");
break;
case PANGO_WEIGHT_ULTRABOLD:
g_print (":Ultrabold");
break;
case PANGO_WEIGHT_HEAVY:
g_print (":Heavy");
break;
case PANGO_WEIGHT_ULTRAHEAVY:
g_print (":Ultraheavy");
break;
}
}
if (mask & PANGO_FONT_MASK_STYLE)
{
switch (pango_font_description_get_style (fnd))
{
case PANGO_STYLE_NORMAL:
break;
case PANGO_STYLE_OBLIQUE:
g_print (":Oblique");
break;
case PANGO_STYLE_ITALIC:
g_print (":Italic");
break;
}
}
if (mask & PANGO_FONT_MASK_SIZE)
{
if (pango_font_description_get_size_is_absolute (fnd))
g_print (":pixelsize=%d", pango_font_description_get_size (fnd) / PANGO_SCALE);
else
g_print (":size=%d", pango_font_description_get_size (fnd) / PANGO_SCALE);
}
g_print ("\n");
break;
}
}
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment