Page 1 of 1

Font rendering differently on mac and ubuntu

Posted: 2009-10-07T10:24:29-07:00
by Georgio_1999
Hi,

I'm just deploying an application to an Ubuntu server and noticed the font rendering was different to my dev machine (mac OS X snow leopard). Specifically here's the mac version:
http://5ftshelf-dev.s3.amazonaws.com/sp ... 243759.png
and here's the unbuntu version:
http://assets1.5ftshelf.com/spines/1/5/ ... 243759.png

As you can see the ubuntu font is brighter and not so smooth.

I've tried copying the font used from my mac (Arial-Regular) to the ubuntu box and using that explicitly but I get the same results. Also I've matched the versions as close I could and checked the changelog in between but can see no obvious contenders (mac version is 6.5.5-0 and ubuntu 6.5.5-10

This leaves me to believe I'm compiling the ubuntu version with a missing library although this is just my best guess at the moment. The current ubuntu options are:

Code: Select all

                  Option                        Value
-------------------------------------------------------------------------------
Shared libraries  --enable-shared=yes		yes
Static libraries  --enable-static=yes		yes
Module support    --with-modules=yes		yes
GNU ld            --with-gnu-ld=yes		yes
Quantum depth     --with-quantum-depth=16	16
High Dynamic Range Imagery
                  --enable-hdri=no		no

Delegate Configuration:
BZLIB             --with-bzlib=yes		no
Autotrace         --with-autotrace=no		no
DJVU              --with-djvu=yes		no
DPS               --with-dps=yes		no
FFTW              --with-fftw=yes		no
FlashPIX          --with-fpx=yes		no
FontConfig        --with-fontconfig=no		no
FreeType          --with-freetype=yes		yes
GhostPCL          None				pcl6 (unknown)
GhostXPS          None				gxps (unknown)
Ghostscript       None				gs (8.61)
Ghostscript fonts --with-gs-font-dir=default	/usr/share/fonts/type1/gsfonts/
Ghostscript lib   --with-gslib=no		no
Graphviz          --with-gvc=yes		no
JBIG              --with-jbig=yes		no
JPEG v1           --with-jpeg=yes		yes
JPEG-2000         --with-jp2=yes		no
LCMS              --with-lcms=yes		no
LQR               --with-lqr=yes		no
Magick++          --with-magick-plus-plus=yes	yes
OpenEXR           --with-openexr=yes		no
PERL              --with-perl=yes		/usr/bin/perl
PNG               --with-png=yes		yes
RSVG              --with-rsvg=no		no
TIFF              --with-tiff=yes		yes
Windows fonts     --with-windows-font-dir=/usr/share/fonts/truetype/msttcorefonts	/usr/share/fonts/truetype/msttcorefonts/
WMF               --with-wmf=yes		no
X11               --with-x=			no
XML               --with-xml=no		no
ZLIB              --with-zlib=yes		yes

X11 Configuration:
      X_CFLAGS        = 
      X_PRE_LIBS      = 
      X_LIBS          = 
      X_EXTRA_LIBS    = 

Options used to compile and link:
  PREFIX          = /usr/local
  EXEC-PREFIX     = /usr/local
  VERSION         = 6.5.5
  CC              = gcc -std=gnu99
  CFLAGS          = -fopenmp -g -O2 -Wall -W -pthread
  MAGICK_CFLAGS   = -fopenmp -g -O2 -Wall -W -pthread
  CPPFLAGS        = -I/usr/local/include/ImageMagick
  PCFLAGS         = -fopenmp
  DEFS            = -DHAVE_CONFIG_H
  LDFLAGS         = -lfreetype -lz
  MAGICK_LDFLAGS  = -L/usr/local/lib -lfreetype -lz
  LIBS            = -lMagickCore -ltiff -lfreetype -ljpeg -lz -lm -lgomp -lpthread 
  CXX             = g++
  CXXFLAGS        = -g -O2 -Wall -W -pthread
I'm not an expert on fonts and imaging, is there anything obvious I'm missing?

George

Re: Font rendering differently on mac and ubuntu

Posted: 2009-10-07T10:51:16-07:00
by fmw42
what versions are the IMs on the two machines? before some version that I would have to research any perspective was done with -filter point or triangle, but after some release the default filter was EWA (area resampling) which can cause some blurring as it tries to antialias things in the distance. To emulate the sharper version on a newer IM add -filter point or -filter triangle before -distort. See if that makes them the same.

see http://www.imagemagick.org/Usage/distor ... a_resample
see http://www.imagemagick.org/script/comma ... php#filter

Re: Font rendering differently on mac and ubuntu

Posted: 2009-10-07T11:07:34-07:00
by magick
ImageMagick utilizes Freetype to render text. Its possible that you have two different versions of Freetype or perhaps the patented Apple hinter is turned on on your Mac for improved results whereas it is not on Ubuntu.

Re: Font rendering differently on mac and ubuntu

Posted: 2009-10-07T17:34:53-07:00
by anthony
Do you have an arial font on your ubuntu machine??? Linux does not normally come with that font as it is copyright to microsoft!

Check what fonts you have with

Code: Select all

  convert -list font
But default if a font is not found IM will silent fall back to a default font. You can enable -debug annotate to check what font (and the file it comes from) is being selected.

Re: Font rendering differently on mac and ubuntu

Posted: 2009-10-08T00:51:55-07:00
by Georgio_1999
Thanks guys, I solved it in the end (after much Googling). I upgraded the freetype library and turned off the bytecode interpreter for TrueType fonts (the opposite of what I expected). This gave the same result on the Ubuntu machine as the mac.

Thanks for all the pointers, would have taken forever to solve otherwise!