Showing posts with label fonts. Show all posts
Showing posts with label fonts. Show all posts

Sunday, March 14, 2010

Embedding Russian/Cyrillic/Unicode Fonts in EPUB books

I'd like to read Russian literature in its original language. So I downloaded Leo Tolstoy's Anna Karenina and put it in my Nook.


  1. The original format of the book was a Word document. I had to save it as text file and convert its character set from Windows Cyrillic (CP1251) to UTF-8 using Iconv.

    iconv -f CP1251 -t UTF-8 annakarenina.txt > annakarenina-u.txt


  2. I opened the text file with Sigil, formatted it and saved it as EPUB file.

  3. Put Unicode fonts in the EPUB file that have a cyrillic range. You can do so with 7-zip. I recommend Book Antiqua, MinionPro or DejaVu Serif.

    • antquab.ttf
    • antquabi.ttf
    • antquai.ttf
    • bkant.ttf


  4. Edit content.opf so that it has references to the fonts:

    <item id="font.bold" href="fonts/antquab.ttf" media-type="application/x-font-truetype"/>

    <item id="font.bolditalic" href="fonts/antquabi.ttf" media-type="application/x-font-truetype"/>

    <item id="font.italic" href="fonts/antquai.ttf" media-type="application/x-font-truetype"/>

    <item id="font.regular" href="fonts/bkant.ttf" media-type="application/x-font-truetype"/>

  5. Edit the stylesheet.

    @font-face {
    font-family: "Book Antiqua";
    font-weight: normal;
    font-style: normal;
    src: url(../fonts/bkant.ttf);
    }
    @font-face {
    font-family: "Book Antiqua";
    font-weight: normal;
    font-style: italic;
    src: url(../fonts/antquai.ttf);
    }
    @font-face {
    font-family: "Book Antiqua";
    font-weight: bold;
    font-style: normal;
    src: url(../fonts/antquab.ttf);
    }
    @font-face {
    font-family: "Book Antiqua";
    font-weight: bold;
    font-style: italic;
    src: url(../fonts/antquabi.ttf);
    }
    a {
    color: inherit;
    text-decoration: inherit;
    }
    em, i {
    font-family: "Book Antiqua", serif;
    font-weight: normal;
    font-style: italic;
    }
    strong, b, h1, h2, h3, h4, h5 {
    font-family: "Book Antiqua", serif;
    font-weight: bold;
    font-style: normal;
    }
    p {
    text-indent: 2em;
    margin-top: 0pt;
    margin-bottom: 0pt;
    }
    body {
    font-family: "Book Antiqua", serif;
    margin-left: 5pt;
    margin-right: 5pt;
    text-align: justify;
    }
    .sgc-1 {text-align: center}
    .sgc-2 {text-align: right}



To see how a Russian ebook might look on your Nook or any other reader, download and try my ebook Anna Karerina.

Saturday, March 13, 2010

Creating Korean eBooks in EPUB format

As far as I know, there aren't a lot of Korean ebooks in EPUB format. However, if you have a Korean literature of any kind, you can create an EPUB file for viewing on a digital reader. Assuming that you have a Korean text file in KSC5601 or UHC character set, you should convert your text file into Unicode encoding. You can do so with iconv.


iconv -f UHC -t UTF-8 oldtext.txt > newtext.txt

Open the new Unicode-encoded text in Sigil, edit it and save it as an EPUB file. Now you should add Korean fonts into your EPUB file. I recommend the following fonts.


  • H2GTRM.TTF
  • H2GTRB.TTF

Then, edit content.opf in your EPUB file so that the manifest section contains the following:


<item id="h2gtrm.ttf" href="fonts/h2gtrm.ttf" media-type="application/x-font-truetype"/>
<item id="h2gtrb.ttf" href="fonts/h2gtrb.ttf" media-type="application/x-font-truetype"/>

Start Sigil again and open your EPUB file. Select the dual editing mode and insert the following CSS definitions into the HTML header.


  @font-face {
font-family: HYGothic-Medium;
font-weight: normal;
font-style: normal;
src: url(../fonts/h2gtrm.ttf);
}
@font-face {
font-family: HYGothic-Bold;
font-weight: bold;
font-style: normal;
src: url(../fonts/h2gtrb.ttf);
}
a {
color: inherit;
text-decoration: inherit;
}
em, i {
font-family: HYGothic-Medium, sans-serif;
font-weight: normal;
font-style: italic;
text-decoration: underline;
}
strong, b, h1, h2, h3, h4, h5, h6 {
font-family: HYGothic-Bold, sans-serif;
font-weight: bold;
font-style: normal;
}
body {
font-family: HYGothic-Medium, sans-serif;
margin-left: 5pt;
margin-right: 5pt;
text-align: justify;
}

Test your ebook with Adobe Digital Editions. It should display Korean correctly.

Sunday, August 23, 2009

MinGW: Compiling FreeType 2.3.5 Statically

This post was part of my MPlayer compilation tutorial. However, FreeType 2.3.5 has become outdated, so I moved its information here.


The Freetype library depends on the iconv library, so let's install the iconv library first. Download libiconv from here. Compile libiconv as follows:


cd ~

tar xvzf libiconv-1.13.tar.gz

cd libiconv-1.13

./configure --prefix=/mingw --disable-shared

make

make install

Now that libiconv has been compiled and installed, download the Freetype2 library from here and install it as follows:


cd ~

tar xzvf freetype-2.3.5.tar.gz

cd freetype-2.3.5

./configure --prefix=/mingw --disable-shared

make

make install

If you get the following error:


In file included from C:/MinGW/MSYS/home/Johnny/freetype-2.3.5/include/freetype/config/ftstdlib.h:123,

from ./builds/unix/ftconfig.h:43,

from C:/MinGW/MSYS/home/Johnny/freetype-2.3.5/src/base/ftsystem.c:29:

C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/stdlib.h:317: error: syntax error before "double"

make: *** [/home/Johnny/freetype-2.3.5/objs/ftsystem.lo] Error 1

make the following change in line 317 of the file C:\MinGW\include\stdlib.h (change inline to __inline__):


__inline__ double __cdecl __MINGW_NOTHROW strtod (const char* __restrict__ __nptr, char** __restrict__ __endptr)

Saturday, July 18, 2009

MinGW: To Compile FreeType 2.3.9

FreeType is an open-source font-rendering library. I am compiling it in order to build MPlayer and GTK+ afterwards. Download the FreeType source from SourceForge and compile it like this:


./configure --prefix=/mingw

make

make install

The following files are installed by FreeType.


bin/freetype-config
bin/libfreetype-6.dll
include/freetype2
include/freetype2/freetype
include/freetype2/freetype/config
include/freetype2/freetype/config/ftconfig.h
include/freetype2/freetype/config/ftheader.h
include/freetype2/freetype/config/ftmodule.h
include/freetype2/freetype/config/ftoption.h
include/freetype2/freetype/config/ftstdlib.h
include/freetype2/freetype/freetype.h
include/freetype2/freetype/ftbbox.h
include/freetype2/freetype/ftbdf.h
include/freetype2/freetype/ftbitmap.h
include/freetype2/freetype/ftcache.h
include/freetype2/freetype/ftchapters.h
include/freetype2/freetype/ftcid.h
include/freetype2/freetype/fterrdef.h
include/freetype2/freetype/fterrors.h
include/freetype2/freetype/ftgasp.h
include/freetype2/freetype/ftglyph.h
include/freetype2/freetype/ftgxval.h
include/freetype2/freetype/ftgzip.h
include/freetype2/freetype/ftimage.h
include/freetype2/freetype/ftincrem.h
include/freetype2/freetype/ftlcdfil.h
include/freetype2/freetype/ftlist.h
include/freetype2/freetype/ftlzw.h
include/freetype2/freetype/ftmac.h
include/freetype2/freetype/ftmm.h
include/freetype2/freetype/ftmodapi.h
include/freetype2/freetype/ftmoderr.h
include/freetype2/freetype/ftotval.h
include/freetype2/freetype/ftoutln.h
include/freetype2/freetype/ftpfr.h
include/freetype2/freetype/ftrender.h
include/freetype2/freetype/ftsizes.h
include/freetype2/freetype/ftsnames.h
include/freetype2/freetype/ftstroke.h
include/freetype2/freetype/ftsynth.h
include/freetype2/freetype/ftsystem.h
include/freetype2/freetype/fttrigon.h
include/freetype2/freetype/fttypes.h
include/freetype2/freetype/ftwinfnt.h
include/freetype2/freetype/ftxf86.h
include/freetype2/freetype/t1tables.h
include/freetype2/freetype/ttnameid.h
include/freetype2/freetype/tttables.h
include/freetype2/freetype/tttags.h
include/freetype2/freetype/ttunpat.h
include/ft2build.h
lib/libfreetype.a
lib/libfreetype.dll.a
lib/libfreetype.la
lib/pkgconfig/freetype2.pc
share/aclocal/freetype2.m4

Wednesday, May 6, 2009

Berthold Caslon Book: My Favorite Serif

Recently, I tried Berthold Caslon Book. I was struck by its visual appeal and high legibility. Researching this family of Caslon typefaces, I learned that the Caslon typefaces have old history and good reputation.


Adobe Caslon Sample

Related:


Tuesday, May 5, 2009

Problem with saving OpenOffice.org documents as PDF

I use OpenOffice 2.4 in Debian Linux 5.0 Lenny, but recently had a problem with exporting OpenOffice.org documents to PDF. Debian Lenny doesn't have OpenOffice.org 3.0 packages yet. I think the problem originates from using obscure Postscript fonts. I used Caslon Book BE in my OpenOffice.org Writer document, but the output of the exported PDF file was unreadable. Actually, the problematic PDF file didn't display any spaces.


illegible02

Eventually, I fixed this problem. I saved the document as a postscript printout and converted it to PDF using pstopdf13.


ps2pdf13 input.ps output.pdf

ooo24ps

Another thing I did to fix the problem was to change Times New Roman fonts in my formulas to Times New Roman PS. I also had to convert all pictures in the document to encapsulated Postscript format and embed them in the document. For EPS conversion of the pictures, I used GIMP.


legible01

Monday, April 20, 2009

Complete Multilingual Font Package for a Linux system

Once in a while, you come across some script that cannot be rendered on screen because you don't have the necessary font. If you are content with English only, then you can ignore this little annoyance. But if you speak another language or a foreign language student, you probably want to get a complete package of multilingual fonts.


As a Linux user, I found it sometimes frustrating or bothersome to have lack of a complete assortment of multilingual fonts. So I looked for fonts of many modern and ancient scripts on the Internet. The following is a list of fonts I collected that allow rendering of all the characters on the Web. You can use these fonts to write multilingual documents, too. A good place to test these fonts on the Web is the Wikipedia homepage.



Basic Minimal Fonts


You need the following font packages for basic rendering of Latin and Western-European alphabets. I use a Debian-based Linux system, so the following packages have Debian package names:



  • ttf-bitstream-vera or

  • ttf-dejavu
  • latex-xft-fonts



Foreign Language Fonts


Additionally you need to download the following TrueType or OpenType fonts to view many foreign scripts other than English and Western European languages. Be aware that the following list is for a minimal multilingual system. There are many more fonts than listed below. You can use Yahoo! Search to find where to download these fonts. Below the contents of my /usr/local/share/fonts directory is shown.


AboriginalSansBOLD.ttf
AboriginalSansBOLDITALIC.ttf
AboriginalSansITALIC.ttf
AboriginalSansREGULAR.ttf
AboriginalSerifBOLD.ttf
AboriginalSerifBOLDITALIC.ttf
AboriginalSerifITALIC.ttf
AboriginalSerifREGULAR.ttf
Aegean.otf
FM-MalithiUW46.ttf
Phetsarath_OT.ttf
TagDoc93.ttf
akshar.ttf
arheiu30.ttf
cursor-felipe.pcf.gz
damase_v.2.ttf
dilyan.ttf
encodings.dir
estre.ttf
evermono.ttf
fonts.cache-1
fonts.dir
fonts.scale
gulim16uni.pcf.gz
h2mjsb.ttf
h2mjsm.ttf
hapaxber.ttf
hei16ascii.pcf.gz
joyig.ttf
malgun.ttf
malgunbd.ttf
micross.ttf
mm3.ttf
mond40uhgs.ttf
nastaliq_unicode.ttf
newathu.ttf
paisan98.ttf
raavi.ttf
silyi.ttf
simsun16ascii.pcf.gz
tagbanwa.ttf
tahoma.ttf
tahomabd.ttf
taileval.ttf
tashi.ttf
tituscbz.ttf
uchen.ttf
vrinda.ttf


Related Posts


Sunday, January 11, 2009

Installing Free Korean Fonts in Windows

Are you looking for free, good Korean fonts? You've come to the right place. Here I show you how to install Un fonts designed by a free Korean fonts project.


First, download the fonts from one of the links here. You may optionally choose to download additional fonts here.


Extract the fonts from the Debian package(s) with PeaZip or TugZip or any other tool.


Take the necessary steps to install the Un Korean truetype fonts in Windows.

Monday, December 22, 2008

Fix Fonts in Vista Lite

Arial, Tahoma and Times New Roman are not displayed correctly when a CD edition of Windows Vista Home Premium is installed on your computer. To fix this problem, follow the following steps:



  1. Click the Start button to open the Start menu.
  2. Type regedit and press Enter. Registry Editor will appear on your screen.
  3. In the left pane, expand the registry tree to navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes.
  4. In the right pane, remove Arial, Microsoft Sans Serif, MS Sans Serif 8,10,12,14,18,24, MS Serif 8,10,12,14,18,24, Small Fonts, Tahoma and Times New Roman by selecting each one and pressing the Delete key. A dialog will pop up and ask you "Deleting certain registry values could cause system instability. Are you sure you want to permanently delete this value?" Answer Yes.
  5. Double-click Helv and replace its value with Arial.
  6. Double-click MS Sans Serif and replace its value with Microsoft Sans Serif.
  7. Replace the value of MS Serif, Times and Tms Rmn with Times New Roman.


Related Posts


Saturday, December 13, 2008

Additional Fonts For Windows

After installing a CD edition of Windows Vista, some fonts necessary for displaying international scripts are missing from the default installation. In order to correctly display foreign characters, the following fonts need to be installed.



  • Aegean.otf

    Covers Basic Latin, Greek and Coptic, Greek Extended, some Punctuation and other Symbols, Linear B Syllabary, Linear B Ideograms, Aegean Numbers, Ancient Greek Numbers, Ancient Symbols, Phaistos Disc, Lycian, Carian, Old Italic, Ugaritic, Old Persian, Cypriot Syllabary, Phoenician, Lydian, Archaic Greek Musical Notation.
  • TagDoc93.ttf for the Tagalog script which had been used in the ancient Philippines
  • cerg_chi.ttf

    Contains both traditional and simplified Chinese ideographs
  • damase_v.2.ttf

    Covers Armenian, Cherokee, Coptic (Bohairic subset), Cypriot Syllabary, Cyrillic (Russian and other Slavic languages), Deseret, Georgian (Asomtavruli and Nuskhuri but no Mkhedruli), Glagolitic, Gothic, Greek (including Coptic characters), Hebrew, Latin, Limbu, Linear B (partial coverage of ideograms and syllabary), Old Italic, Old Persian cuneiform, Osmanya, Phoenician, Shavian, Syloti Nagri (no conjuncts), Tai Le (no combining tone marks), Thaana, Tifinagh, Ugaritic, and Vietnamese.
  • dilyan.ttf for Glagolitic and Cyrillic (Old Church Slavonic) alphabets.
  • hapaxber.ttf for the Tifinagh script which is used to write Berber languages in North Africa.
  • ipagp.ttf to display the Japanese language.
  • malgun.ttf and malgunbd.ttf to display the Korean language.
  • mm3.ttf for the Burmese/Myanmar script.
  • newathu.ttf

    Covers English and Western European languages, polytonic Greek, Coptic, Old Italic, and Demotic Egyptian transliteration, as well as metrical symbols and other characters used by classical scholars.
  • tagbanwa.ttf for the Tagbanwa script which had been used in the ancient Philippines.
  • taileval.ttf for the Tai Le script.


OpenOffice.org 3.0 installs the DejaVu and Open Symbols fonts.

To see a list of fonts installed by Microsoft Office 2007, go here.

Related Posts


About This Blog

KBlog logo This blog is about current events and issues concerning general population. Thanks for visiting the blog and posting your comments.

© Contents by KBlog

© Blogger template by Emporium Digital 2008

Followers

Total Pageviews

icon
Powered By Blogger