GithubHelp home page GithubHelp logo

eugmes / fntsample Goto Github PK

View Code? Open in Web Editor NEW
23.0 7.0 4.0 390 KB

PDF and PostScript font samples generator (migrating from https://sourceforge.net/projects/fntsample/)

License: GNU General Public License v3.0

Roff 12.67% C 57.53% Perl 15.74% CMake 14.06%
fonts unicode pdf

fntsample's Introduction

fntsample

build License: GPL v3

fntsample is a tool that can be used to make font samples that show coverage of the font and are similar in appearance to Unicode Charts. It was developed for use with DejaVu Fonts project. fntsample is licensed under GPL version 3 or later.

Output example

Features

  • Support for various font formats using FreeType library, including TrueType, OpenType, and Type1.
  • Creating samples in PDF, PostScript, and SVG formats.
  • Adding outlines with Unicode block names for PDF samples.
  • Selection of code ranges to show in charts.
  • Comparing of two font files with highlighting of added glyphs.
  • Runs on Linux and other Unix-like systems.

Download

Releases are available from releases page. For source code releases for versions before 5.0 visit the old project page. The source code and issues tracker are accessible via the project page.

Building

The following libraries are required to build fntsample: cairo, fontconfig, FreeType2, GLib, Pango, gettext. They should be available in most Linux distributions. Additionally Unicode blocks file is required.

CMake is used to build the code. In the directory with source code execute:

% mkdir build
% cd build
% cmake .. -DUNICODE_BLOCKS=/path/to/Blocks.txt
% make
% make install

The last step will install files under /usr/local by default. This can be overridden by adding -DCMAKE_INSTALL_PREFIX=/another/prefix to the cmake invocation.

fntsample could be built using Homebrew on macOS. Use the following commands to install dependencies and configure the build environment before building the code:

% brew install cmake pgk-config gettext cairo pango fontconfig freetype glib
% export CMAKE_PREFIX_PATH=/usr/local/opt/gettext

Alternatively you can install fntsample using a Homebrew formula:

% brew install eugmes/fntsample/fntsample

Usage

The basic usage for fntsample looks as follows:

% fntsample -f /file/to/font/file.ttf -o output.pdf

For more advanced usage consult the man pages for fntsample and pdfoutline.

fntsample's People

Contributors

eugmes avatar khaledhosny avatar biergaizi avatar waldyrious avatar

Stargazers

Ger Hobbelt avatar Tariq Erwa avatar  avatar Masanori Ogino avatar  avatar Bocke avatar  avatar NFSL2001 avatar dylan avatar justin aquino avatar 欧剃 | 游荡的坎德人 avatar  avatar  avatar  avatar Ismaël Mejía avatar Matthew Smith avatar iomonad avatar Bastien Dejean avatar  avatar mastaiza avatar Behdad Esfahbod avatar Shriramana Sharma avatar

Watchers

 avatar  avatar  avatar James Cloos avatar Janusz S. Bień avatar justin aquino avatar  avatar

fntsample's Issues

Migrate to CMake

Use some better build system. The biggest problem is gettext support.

Travis-ci: build is failing on AMD64

Hi,

I am trying to enable ppc64le build on travis. But while testing, its failing on AMD64 itself only with below error:

"
/home/travis/build/sanjaymsh/fntsample/src/fntsample.c:47:32: error: initializer element is not constant
static const double A4_WIDTH = 8.3 * POINTS_PER_INCH;
^~~
/home/travis/build/sanjaymsh/fntsample/src/fntsample.c:48:33: error: initializer element is not constant
static const double A4_HEIGHT = 11.7 * POINTS_PER_INCH;
^~~~
/home/travis/build/sanjaymsh/fntsample/src/fntsample.c:50:35: error: initializer element is not constant
static const double xmin_border = POINTS_PER_INCH / 1.5;
^~~~~~~~~~~~~~~
/home/travis/build/sanjaymsh/fntsample/src/fntsample.c:51:35: error: initializer element is not constant
static const double ymin_border = POINTS_PER_INCH;
^~~~~~~~~~~~~~~
/home/travis/build/sanjaymsh/fntsample/src/fntsample.c:52:34: error: initializer element is not constant
static const double cell_width = (A4_WIDTH - 2 * xmin_border) / 16;
^
/home/travis/build/sanjaymsh/fntsample/src/fntsample.c:53:35: error: initializer element is not constant
static const double cell_height = (A4_HEIGHT - 2 * ymin_border) / 16;
^
src/CMakeFiles/fntsample.dir/build.make:67: recipe for target 'src/CMakeFiles/fntsample.dir/fntsample.c.o' failed
make[2]: *** [src/CMakeFiles/fntsample.dir/fntsample.c.o] Error 1
CMakeFiles/Makefile2:155: recipe for target 'src/CMakeFiles/fntsample.dir/all' failed
make[1]: *** [src/CMakeFiles/fntsample.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2
The command "make package" exited with 2.
0.00s$ tar tzf fntsample-.tar.gz
tar (child): fntsample-.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
The command "tar tzf fntsample-*.tar.gz" exited with 2.
Done. Your build exited with 1.
"

The full error can be tracked here: https://travis-ci.com/github/sanjaymsh/fntsample/builds/189670049

Please have a look on this.

Thanks !!

[solved] noto characters in PDF that are not related to actual content (probably just style related), how do I change it?

here is an example
arial.ttf
arial.ttf.zip

arial.ttf.pdf
arial.ttf.pdf.zip


running on Cygwin,
which relay on C:\Windows\Fonts\ for actual having other fonts
I've edited C:\cygwin\etc\fonts\fonts.conf

<!-- Font directory list -->

+<dir>/cygdrive/C/Windows/Fonts</dir>
+<dir>C:/Windows/Fonts</dir>
+<dir>/usr/share/fonts</dir>

fonts.zip

and then the result was looking fine,


my suggestion/question is,
how to control, what I assume is a hard-codded styling for the PDF,

or an ability to control the non-critical presentation layer of the PDF,
either of those would be greatly appreciated.

Full build instructions

I've had some trouble building this on a macOS, and thought I'd report the final set of commands I had to run to make it work:

git clone https://github.com/eugmes/fntsample
cd fntsample
brew install cairo fontconfig freetype glib pango
wget --no-check-certificate https://unicode.org/Public/UNIDATA/Blocks.txt
mkdir build
cd build
export CMAKE_INCLUDE_PATH=/usr/local/Cellar/gettext/0.20.1/include
cmake .. -DUNICODE_BLOCKS=../Blocks.txt
make

I'd highlight in particular the need to tell CMake about Homebrew's gettext include path via export CMAKE_INCLUDE_PATH. Without this, CMake was erroring with the following message:

  Failed to find Gettext libintl (missing: Intl_INCLUDE_DIR)

Note that Homebrew does not expose its gettext paths on purpose, to avoid overriding the system ones:

$ brew link gettext
Warning: Refusing to link macOS provided/shadowed software: gettext
If you need to have gettext first in your PATH run:
  echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.zshrc

For compilers to find gettext you may need to set:
  export LDFLAGS="-L/usr/local/opt/gettext/lib"
  export CPPFLAGS="-I/usr/local/opt/gettext/include"

However, CMake doesn't detect the system gettext either...

I would hope that this process could be more streamlined for macOS. In any case, I hope this issue will help others who run into the same problems.

Unicode support

I'm assuming fntsample support utf-8 in the pdfoutline tool? I'm seeing this garbage when trying to create an outline from a txt file (utf-8) with hebrew titles.... both in Linux (Ubuntu) document viewer and Emacs etc.

screenshot

Add option to render missing glyphs with FreeSerif

Originally from: https://sourceforge.net/p/fntsample/bugs/6/

Please, add an option to render missing glyphs with FreeSerif (or another font for which the complete TTF or OTF font path is specified ) on a red background. Implementing this will inform the using what the missing glyphs should look like or represent.

Note that the red background should differ when printed in gray scale from the currently used blue, gray and black backgrounds. For example the color #FF8888 could be used for this.

Option to produce landscape output

It would be great if fntsample had an option to produce landscape output with the columns from current portrait transposed to rows.

Use case: when making a presentation about glyphs contained in a font, landscape makes it much easier and helps better visibility of the glyphs.

Now I am having to manually draw a landscape chart using some other software.

Thanks!

Suggestion: enable printing glyphs not assigned to a unicode slot

Currently it prints unicode blocks, which in the case of fonts with alternates accessed with opentype features does not print all of the glyphs, unless they are assigned to the private use area.

Extra glyphs could be printed in a separate page after unicode, or there could be a mode to print glyphs in the order they are in the font, or some other order entirely.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.