View Single Post
Old 11-11-2010, 08:33 AM   #1
jharker
Developer
jharker could sell banana peel slippers to a Deveel.jharker could sell banana peel slippers to a Deveel.jharker could sell banana peel slippers to a Deveel.jharker could sell banana peel slippers to a Deveel.jharker could sell banana peel slippers to a Deveel.jharker could sell banana peel slippers to a Deveel.jharker could sell banana peel slippers to a Deveel.jharker could sell banana peel slippers to a Deveel.jharker could sell banana peel slippers to a Deveel.jharker could sell banana peel slippers to a Deveel.jharker could sell banana peel slippers to a Deveel.
 
Posts: 345
Karma: 3473
Join Date: Apr 2007
Location: Brooklyn, NY, USA
Device: iRex iLiad v1, Blackberry Tour, Kindle DX, iPad.
Need help - measuring fonts in iBooks

Hey, folks! I'm working on divining some of the darker corners of how iBooks works, and I need a little help. Long story short, I need someone to download the attached file, open it in iBooks on their Apple device, and either post a screenshot or just copy the displayed text and post it here (along with what kind of device you have). The more the merrier!

I have an iPad, but I don't have an iPhone, iPhone 4, iPod Touch, or any other Apple device. I've done this for the iPad, but need information on the other devices. Can anyone help?

The long version:

I've created a special ePub file (attached below). This file has some Javascript in it which does the following:
  • It typesets a string of 10 letters (for example, ten "a"s, or ten "G"s).
  • It measures the displayed width of the string.
  • It does this for a wide selection of different characters.
  • Finally, it adds a new paragraph to the page displaying the measured character widths, along with the currently selected font family and font size.
So the way it works is, you open the file, and it will tell you what font family you're using, what the font size is, and the exact width of various characters.

If you change the font family or font size, then you need to re-open the file and it will refresh the information. I would love to get data from a wide variety of Apple devices, and for a wide selection of font families and sizes.

Bonus points for answering the question: what is the smallest size font you can select?
  1. Open this file, select "Baskerville" font, and reduce the font size until you can't reduce it any more.
  2. Then close and re-open the file.
  3. What font size is given?
On my iPad, the smallest Baskerville font size is 16px, while the smallest Cochin size is 18px.

I'm hoping to learn that fonts are rendered the same on every device, but even knowing that they're different would be a great help.

Here's sample output from 16px Baskerville on the iPad:
Code:
Font size = 16px Font family = Baskerville
0, 0, 40, 65, 29, 39, 39, 40, 50, 40, 40, 40, 70, 109, 99, 115, 122, 100, 89,
124, 129, 57, 57, 125, 97, 149, 120, 132, 90, 117, 87, 112, 124, 152, 109,
55, 55, 75, 84, 69, 84, 70, 44, 75, 85, 40, 40, 74, 39, 129, 85, 80, 84, 84,
59, 54, 47, 84, 74, 109, 77, 74, 69, 160
Thanks in advance for any brave folks willing to help me out!

Edit: Font measurements are actually given in tenths of pixels. So "109" means the character is 10.9 pixels wide.
Attached Files
File Type: epub Test ePub 9.epub (3.4 KB, 141 views)

Last edited by jharker; 11-11-2010 at 08:45 AM. Reason: Fix typos, improve formatting
jharker is offline   Reply With Quote