Patrick Thomas | 22 Apr 07:51 2014
Picon

[ft] rendering of TrueType hints

Hi,

I'm not certain where the best place to ask this question might be and I apologize if this is the wrong forum.

I'm trying to hint a TrueType font using FontForge and Xgridfit on Ubuntu and I'm confused about why some pixels are not being rendered. I believe FontForge is using FreeType 2.

I'm using the following instructions in Xgridfit to turn off dropout control:

<pre-program>
    <set-dropout-control flags="0" threshold="0"/>
    <set-dropout-type value="2"/>
</pre-program>

My understanding is that a pixel should then be rendered if and only if its center falls within or on the resulting gridfitted outline?

In the attached screenshot from FontForge the coordinates of the final gridfitted points are (2,5), (0,7), (10,17) and (12,15) at 27 point, 96 dpi. I would then expect that the pixels with centers (2.5, 5.5) and (10.5, 16.5), which fall on the resulting outline, would be rendered, but they are not. The same relatively positioned pixels are also not rendered at other point sizes.

Thank you very much for your time and help.

Patrick
_______________________________________________
Freetype mailing list
Freetype <at> nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype
Preet | 2 Apr 10:08 2014
Picon

[ft] gzip dependency in the sfnt module for version 2.5.3?

Hiya,

I'm trying to build freetype 2.5.3 directly into a project without
using autoconf and associated GNU make tools. I've been trying to
follow the CUSTOMIZE and INSTALL.ANY install notes in the
documentation directory.

When trying to build, I get an 'undefined reference to
FT_Gzip_Uncompress' error from sfobjs.c in the sfnt module. As I want
to build without zlib support I've disabled both
FT_CONFIG_OPTION_USE_LZW and FT_CONFIG_OPTION_USE_ZLIB in ftoption.h.

FT_Gzip_Uncompress seems to be defined in the gzip module... but that
module isn't listed as being necessary for sfnt in the docs. Also,
older versions of sfobjs.c don't seem to call FT_Gzip_Uncompress (I
looked at sfobjs.c in 2.4.2)...

So is gzip just a requirement for newer versions of freetype2 to use
the sfnt module? I'd appreciate any clarification.

Regards,

Preet
Ivan Hamer | 28 Mar 17:26 2014
Picon

[ft] Freetype on memory constrained systems

I am trying to cross-compile freetype to be used on an embedded system. The binary generated seems to be taking up roughly 2MB, which is unacceptable due to memory constraints (512KB-1MB could work).
Does anyone have ideas on making the library smaller, even at the cost of removing features? 
_______________________________________________
Freetype mailing list
Freetype <at> nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype
Werner LEMBERG | 23 Mar 11:42 2014
Picon

[ft] ttfautohint 1.00 has been released!


http://freetype.org/ttfautohint

ttfautohint 1.00 has been released.  It took me three years of hard
work to finally present a version that I consider as usable for daily
work.

If you like my efforts, or can actually use ttfautohint in your
business, please donate to the pledgie campaign at

  https://pledgie.com/campaigns/15816

There you can also find my roadmap for future work.

  Thanks in advance :-)

    Werner

======================================================================

The source tarball, statically-linked binaries for Win32 (TTY and GUI)
and OS X (TTY only) are available from

    http://savannah.nongnu.org/download/freetype/

or

    http://sourceforge.net/projects/freetype/files/ttfautohint/1.00

Instructions to build the GUI version on OS X can be found at

    http://freetype.org/ttfautohint/osx.html

Enjoy!

   Werner

PS: Downloads from savannah.nongnu.org will redirect to your nearest
    mirror site.  Files on mirrors may be subject to a replication
    delay of up to 24 hours.  In case of problems use
    http://download-mirror.savannah.gnu.org/releases/

----------------------------------------------------------------------

This project provides a library which takes a TrueType font as the
input, remove its bytecode instructions (if any), and return a new
font where all glyphs are bytecode hinted using the information given
by FreeType's auto-hinting module.  The idea is to provide the
excellent quality of the auto-hinter on platforms which don't use
FreeType.

The library has a single API function, `TTF_autohint'; see source code
file `lib/ttfautohint.h' for a detailed description.  Note that the
library itself won't get installed currently.

A command-line interface to the library is the `ttfautohint' program;
after compilation and installation, say

  ttfautohint --help

for usage information, or say

  man ttfautohint

to read its manual page.

A GUI to the library is `ttfautohintGUI'; it uses the Qt4 framework.
The compilation of this application can be disabled with the
`--without-qt' configuration option.

----------------------------------------------------------------------

New in 1.00:

* Much less memory consumption while handling fonts with complicated
  glyphs.

* Option `-s' was partially broken.
Nick P | 18 Mar 12:19 2014
Picon

[ft] Problem using Apple sbix format ttf file

Using the latest freetype 2.5.3 the Apple Color Emoji.ttf file on a Mac works fine. However freetype fails to load the glyphs using an iPhone's AppleColorEmoji <at> 2x.ttf file.

Example code:

error = FT_New_Face(library_, "/System/Library/Fonts/Cache/AppleColorEmoji <at> 2x.ttf", 0, &face_);

...

// Error happens here
error = FT_Load_Glyph(face_, glyph_index, FT_LOAD_COLOR);


It looks like either the iphone sbix format used is slightly different, or the png format has been customized...?

Thanks
Nick

_______________________________________________
Freetype mailing list
Freetype <at> nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype
Werner LEMBERG | 11 Mar 11:41 2014
Picon

[ft] new Pledgie campaign


This is a call for a new Pledgie campaign to support my expenses in
2014.  Thanks to all donors, the last campaign was successful, and all
goals have been reached!

  https://pledgie.com/campaigns/24434


If your company is using FreeType in your product, and you care about
continuing support and further development, please contribute to my
funding effort so I can continue to bring the best text rendering to
your devices!

Alternatively, direct donations to my PayPal account are also highly
welcome :-)


Roadmap
-------

Besides user support and fixing bugs, your money will help me
implement the following issues.

. Setting up a test framework for FreeType. This is a huge, long-term
  undertaking that will ensure both stability and reliability of the
  library.  The idea is to collect test cases (mainly broken fonts)
  that cover as much source code as possible.  Another idea to
  investigate is the development of scripts that can generate both
  valid and invalid input data to systematically increase the coverage
  of executed library code, including the unlikely cases.  Finally,
  images of valid, well-rendered input fonts could be collected: As
  soon as a change to the rendering image gets applied, a comparison
  run with those images should detect rendering regressions.

. Further improvements to the auto-hinter.  Right now, the module for
  Indic support is a dummy, and support for the family of Arabic
  scripts is completely missing.  Both investigation and research is
  necessary to find out how much auto-hinting is possible and useful,
  and whether other, completely different scripts can be supported at
  all.

. Right now, rendering Type 1 and CID-keyed fonts is the weakest part
  of FreeType.  However, we now have a brand-new module for handling
  CFF.  Given that CFF is very similar to Type 1, it should be not too
  difficult to use and/or extend the CFF code so that Type 1 fonts can
  be handled, too.

. Explore whether it makes sense to merge FreeType with (parts of) the
  HarfBuzz library.  Since version 2.5.3, FreeType already links to
  HarfBuzz to use its abilities for scanning OpenType layout features,
  and more integration might be sensible for both libraries.

. More improvements to this website.  Last year I’ve redesigned the
  FreeType website.  However, a large bunch of documents are still
  using the old design, and some of them are also no longer up to
  date.

Thanks in advance for your support!


    Werner
_______________________________________________
Freetype mailing list
Freetype <at> nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype
Werner LEMBERG | 9 Mar 05:41 2014
Picon

[ft] FreeType 2.5.2 has been released.


FreeType 2.5.3 has been released.

It is available from

    http://savannah.nongnu.org/download/freetype/

or

    http://sourceforge.net/projects/freetype/files/

The latter site also holds older versions of the FreeType library.

See below for the relevant snippet from the CHANGES file; all users
should upgrade.

Enjoy!

   Werner

PS: Downloads from savannah.nongnu.org will redirect to your nearest
    mirror site.  Files on mirrors may be subject to a replication
    delay of up to 24 hours.  In case of problems use
    http://download-mirror.savannah.gnu.org/releases/

----------------------------------------------------------------------

FreeType 2  is a software  font engine that  is designed to  be small,
efficient,  highly   customizable,  and  portable   while  capable  of
producing high-quality output (glyph images) of most vector and bitmap
font formats.

Note that  FreeType 2 is  a font service  and doesn't provide  APIs to
perform higher-level features, like text layout or graphics processing
(e.g.,  colored  text  rendering,  `hollowing',  etc.).   However,  it
greatly simplifies these tasks by providing a simple, easy to use, and
uniform interface to access the content of font files.

FreeType  2  is  released  under  two open-source  licenses:  our  own
BSD-like FreeType  License and the  GPL.  It can  thus be used  by any
kind of projects, be they proprietary or not.

----------------------------------------------------------------------

CHANGES BETWEEN 2.5.2 and 2.5.3

  I. IMPORTANT BUG FIXES

    - A vulnerability was  identified and fixed in the  new CFF driver
      (cf. http://savannah.nongnu.org/bugs/?41697;  it doesn't  have a
      CVE number yet).  All users should upgrade.

    - More  bug  fixes related  to  correct  positioning of  composite
      glyphs.

    - Many fixes to better protect against malformed input.

  II. IMPORTANT CHANGES

    - FreeType can now use the HarfBuzz library to greatly improve the
      auto-hinting of  fonts that  use OpenType features:  Many glyphs
      that are part  of such features but don't have  cmap entries are
      now handled  properly, for  example small caps  or superscripts.
      Define the configuration  macro FT_CONFIG_OPTION_USE_HARFBUZZ to
      activate HarfBuzz support.

      You need HarfBuzz version 0.9.19 or newer.

      Note that HarfBuzz depends on  FreeType; this currently causes a
      chicken-and-egg problem  that can be  solved as follows  in case
      HarfBuzz is not yet installed on your system.

        1. Compile  and  install  FreeType without  the  configuration
           macro FT_CONFIG_OPTION_USE_HARFBUZZ.

        2. Compile and install HarfBuzz.

        3. Define  macro  FT_CONFIG_OPTION_USE_HARFBUZZ, then  compile
           and install FreeType again.

      With FreeType's  `configure' script the procedure  boils down to
      configure, build, and install Freetype, then configure, compile,
      and  install  HarfBuzz,  then configure,  compile,  and  install
      FreeType again (after executing `make distclean').

    - All  libraries FreeType  depends on  are now  checked using  the
      `pkg-config' configuration files  first, followed by alternative
      methods.

    - The  new  value  `auto'  for the  various  `--with-XXX'  library
      options   (for   example   `--with-harfbuzz=auto')   makes   the
      `configure' script automatically link to the libraries it finds.
      This is now the default.

    - In case FreeType's `configure' script  can't find a library, you
      can  pass environment  variables to  circumvent pkg-config,  and
      those variables  have been  harmonized as  a consequence  of the
      changes mentioned above:

        LIBZ           -> removed; use LIBZ_CFLAGS and LIBZ_LIBS
        LIBBZ2         -> removed; use BZIP2_CFLAGS and BZIP2_LIBS
        LIBPNG_LDFLAGS -> LIBPNG_LIBS

      `./configure --help' shows all available environment variables.

    - The `freetype-config'  script now understands  option `--static'
      to emit static linking information.
Darko Vujičić | 7 Mar 13:55 2014
Picon

[ft] Loading Type42 font

Hello,

Is there any sample code how to load PostScript type42 font into freetype? 
_______________________________________________
Freetype mailing list
Freetype <at> nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype
昌霖 | 6 Mar 08:40 2014
Picon

Re: [ft] Problem on render 'j' on non-monospace font face.

Hi,

  Thanks for your hint.
  I found the problem is cause by the bitmap_left is negative for character j, so I will have wrong index when copy the bitmap image to opencv.

Regards,
Changlin


2014-03-06 15:14 GMT+08:00 昌霖 <hsieh.boss <at> gmail.com>:
Hi,

  Thanks for your hint.
  I found the problem is cause by the bitmap_left is negative for character j, so I will have wrong index when copy the bitmap image to opencv.

Regards,
Changlin


2014-03-06 14:36 GMT+08:00 suzuki toshiya <mpsuzuki <at> hiroshima-u.ac.jp>:

Hi,

I could reproduce the problem by your testing code,
but yet I'm not sure if this is FreeType2 problem.
Because,

1) if I use "ftstring" included in freetype2-demos
(you can use your own testing text, although the
default text is "brown fox...".)

2) if I execute your program with bigger glyph size
(e.g. height=128 etc), my impression on the "bug dot"
at the lower-right corner of "j" is looking like a
clipped overflow from the lower-left end of "j".
If I look very carefully, the lower-left end of "j"
is not connected smoothly, it seems as if there is
a crack.

Could you check more detail on the code copying
the bitmap image from FreeType2 to OpenCV?

# Yet I've not checked your code at all.

Regards,
mpsuzuki

On 03/06/2014 03:03 PM, 昌霖 wrote:
> Hi everyone,
>
>    I am new for freetype library, and trying to following the tutorial to render text into opencv mat.
>    And I have some problem on non-monospace font face like Ubuntu Regular.
>    Following is my testing code and it can also be downloaded from my dropbox page.
> https://www.dropbox.com/sh/qp93w5fzcu9hbcq/VSABZHiNV1
>    That page include my testing code, render output, and test font face.
>    You can compile it by using the following command:
>    "g++ -o test_ubuntu_regular test_freetype.cpp `pkg-config opencv --cflags --libs` -I/usr/include/freetype2 -lfreetype"
>    "g++ -o test_ubuntu_regular_mono test_freetype.cpp `pkg-config opencv --cflags --libs` -I/usr/include/freetype2 -lfreetype -D_USE_MONO_"
>    I also try to use kerning to solve the problem but the delta vector always return (0,0).
>
> Thanks for yours kindly help.
> Changlin
>
> ==========================================================================================
> #include <string>
> #include <iostream>
> #include <opencv2/core/core.hpp>
> #include <opencv2/imgproc/imgproc.hpp>
> #include <opencv2/highgui/highgui.hpp>
> #include <ft2build.h>
> #include FT_FREETYPE_H
>
> using namespace std;
> using namespace cv;
>
> int main(int arch, char* argv[])
> {
>      ///Setup test font, font size, and string
> #ifndef _USE_MONO_
>      string test_font = "Ubuntu-R.ttf";
> #else
>      string test_font = "UbuntuMono-R.ttf";
> #endif
>      string test_string = "jjj abcdefghijklmnopqrstuvwxyz jjj";
>      int height = 32;
>
>      FT_UInt status;
>      ///Initialize library
>      FT_Library library;
>      status = FT_Init_FreeType(&library);
>      if (status)
>      {
>          cout<<"Freetype library initialization failed"<<endl;
>          return 1;
>      }
>      ///Load font face
>      FT_Face face;
>      status = FT_New_Face(library, test_font.c_str(), 0, &face);
>      if (status)
>      {
>          cout<<"Freetype load font face failed"<<endl;
>          return 1;
>      }
>      ///Set font size
>      status = FT_Set_Pixel_Sizes(face, 0, height);
>      if (status)
>      {
>          cout<<"Freetype set size failed"<<endl;
>          return 1;
>      }
>      ///Render to text_image
>      Mat text_image;
>      int max_height=0;
>      FT_GlyphSlot slot=face->glyph;
>      for (size_t t=0; t<test_string.size(); t++)
>      {
>          ///Load and render character
>          status = FT_Load_Char(face, test_string[t], FT_LOAD_RENDER );
>          if (status)
>          {
>              cout<<"Freetype load char \""<<test_string[t]<<"\" failed"<<endl;
>              continue;
>          }
>          ///Compute max height of character image for concat them
>          max_height = max(max_height, height-slot->bitmap_top+slot->bitmap.rows);
>          ///Create character image
>          Mat char_image=Mat::zeros(max_height, slot->advance.x/64, CV_8UC1);
>          for (int y=height-slot->bitmap_top, j=0; j<slot->bitmap.rows; y++, j++)
>          {
>              uchar* scanline = char_image.ptr<uchar>(y);
>              for (int x=slot->bitmap_left, i=0; i<slot->bitmap.width; x++, i++)
>              {
>                  if (x>=char_image.cols)
>                  {
>                      continue;
>                  }
>                  scanline[x] |= slot->bitmap.buffer[j*slot->bitmap.pitch+i];
>              }
>          }
>          ///Concat character image to text image
>          if (text_image.empty())
>          {
>              text_image=char_image;
>          }
>          else
>          {
>              if (max_height>text_image.rows)
>              {
>                  copyMakeBorder(text_image, text_image, 0, max_height-text_image.rows, 0, 0, BORDER_CONSTANT, Scalar(0));
>              }
>              hconcat(text_image, char_image, text_image);
>          }
>      }
>
> #ifndef _USE_MONO_
>      imwrite("ubuntu-regular.png", text_image);
> #else
>      imwrite("ubuntu-regular-mono.png", text_image);
> #endif
> }
> ==============================================================================================
>
>
> _______________________________________________
> Freetype mailing list
> Freetype <at> nongnu.org
> https://lists.nongnu.org/mailman/listinfo/freetype
>



_______________________________________________
Freetype mailing list
Freetype <at> nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype
昌霖 | 6 Mar 07:03 2014
Picon

[ft] Problem on render 'j' on non-monospace font face.

Hi everyone,

  I am new for freetype library, and trying to following the tutorial to render text into opencv mat.
  And I have some problem on non-monospace font face like Ubuntu Regular.
  Following is my testing code and it can also be downloaded from my dropbox page.
  https://www.dropbox.com/sh/qp93w5fzcu9hbcq/VSABZHiNV1
  That page include my testing code, render output, and test font face.
  You can compile it by using the following command:
  "g++ -o test_ubuntu_regular test_freetype.cpp `pkg-config opencv --cflags --libs` -I/usr/include/freetype2 -lfreetype"
  "g++ -o test_ubuntu_regular_mono test_freetype.cpp `pkg-config opencv --cflags --libs` -I/usr/include/freetype2 -lfreetype -D_USE_MONO_"
  I also try to use kerning to solve the problem but the delta vector always return (0,0).

Thanks for yours kindly help.
Changlin

==========================================================================================
#include <string>
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <ft2build.h>
#include FT_FREETYPE_H

using namespace std;
using namespace cv;

int main(int arch, char* argv[])
{
    ///Setup test font, font size, and string
#ifndef _USE_MONO_
    string test_font = "Ubuntu-R.ttf";
#else
    string test_font = "UbuntuMono-R.ttf";
#endif
    string test_string = "jjj abcdefghijklmnopqrstuvwxyz jjj";
    int height = 32;

    FT_UInt status;
    ///Initialize library
    FT_Library library;
    status = FT_Init_FreeType(&library);
    if (status)
    {
        cout<<"Freetype library initialization failed"<<endl;
        return 1;
    }
    ///Load font face
    FT_Face face;
    status = FT_New_Face(library, test_font.c_str(), 0, &face);
    if (status)
    {
        cout<<"Freetype load font face failed"<<endl;
        return 1;
    }
    ///Set font size
    status = FT_Set_Pixel_Sizes(face, 0, height);
    if (status)
    {
        cout<<"Freetype set size failed"<<endl;
        return 1;
    }
    ///Render to text_image
    Mat text_image;
    int max_height=0;
    FT_GlyphSlot slot=face->glyph;
    for (size_t t=0; t<test_string.size(); t++)
    {
        ///Load and render character
        status = FT_Load_Char(face, test_string[t], FT_LOAD_RENDER );
        if (status)
        {
            cout<<"Freetype load char \""<<test_string[t]<<"\" failed"<<endl;
            continue;
        }
        ///Compute max height of character image for concat them
        max_height = max(max_height, height-slot->bitmap_top+slot->bitmap.rows);
        ///Create character image
        Mat char_image=Mat::zeros(max_height, slot->advance.x/64, CV_8UC1);
        for (int y=height-slot->bitmap_top, j=0; j<slot->bitmap.rows; y++, j++)
        {
            uchar* scanline = char_image.ptr<uchar>(y);
            for (int x=slot->bitmap_left, i=0; i<slot->bitmap.width; x++, i++)
            {
                if (x>=char_image.cols)
                {
                    continue;
                }
                scanline[x] |= slot->bitmap.buffer[j*slot->bitmap.pitch+i];
            }
        }
        ///Concat character image to text image
        if (text_image.empty())
        {
            text_image=char_image;
        }
        else
        {
            if (max_height>text_image.rows)
            {
                copyMakeBorder(text_image, text_image, 0, max_height-text_image.rows, 0, 0, BORDER_CONSTANT, Scalar(0));
            }
            hconcat(text_image, char_image, text_image);
        }
    }

#ifndef _USE_MONO_
    imwrite("ubuntu-regular.png", text_image);
#else
    imwrite("ubuntu-regular-mono.png", text_image);
#endif
}
==============================================================================================
_______________________________________________
Freetype mailing list
Freetype <at> nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype
Arkadiusz Miśkiewicz | 12 Feb 15:45 2014
Picon

[ft] rendering problem with soft hyphen


Hi.

Trying to figure out why in my google chrome soft hyphen characters are 
rendered incorrectly (are visible while shouldn't)
Example
http://ixion.pld-linux.org/~arekm/weirdtext.html
looks like
http://ixion.pld-linux.org/~arekm/weirdtext.png

so soft hyphen (00 AD) gets rendered while it shouldn't be.  Example on 
wikipedia http://en.wikipedia.org/wiki/Soft_hyphen also gets rendered 
incorrectly.

While trying to find out what could be cause of this I've tried ftview - is 
ftview behaviour correct one? txt one looks really weird while html one 
renders these soft hyphen characters as visible. See screenshots.

$ ftview -m "$(cat test/weirdtext.html)" 12 
/usr/share/fonts/TTF/LiberationSans-Regular.ttf

$ ftview -m "$(cat test/weirdtext.txt)" 12 
/usr/share/fonts/TTF/LiberationSans-Regular.ttf

freetype 2.5.2 (also tried git master)
--

-- 
Arkadiusz Miśkiewicz, arekm / maven.pl

Prze
Przepis dotyczcy zatrzymywania prawa jazdy dunikom alimentacyjnym jest zgodny z
konstytucj i wyraon w ustawie zasadniczej zasad proporcjonalnoci - orzek
Trybuna Konstytucyjny.
_______________________________________________
Freetype mailing list
Freetype <at> nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype

Gmane