Printer’s Apprentice 8.0.22 – New Character Set Support

October 15th, 2008 by Bryan Kinkel

Printer’s Apprentice 8.0.22 adds support for displaying character sets besides the standard 255 glyphs in the standard Latin Windows set (1252). This enables you to easily display and print characters found in non-Western alphabets such as Hebrew, Greek and Cyrillic.

You can download this version from the following link:

icon_greenarrow16 Download Printer’s Apprentice 8.0.22 for Vista & XP

In this post, I want to review how non-Western characters are implemented under Windows and the new features in Printer’s Apprentice 8.0.22.

Windows supports the Unicode standard along with several code pages that are included for backward compatibility. Unicode supports over 65,000 characters with defined subsets for different languages and glyphs (Latin, Greek, Arabic, etc). More information about Unicode can be found at unicode.org. Wikipedia also has a good article covering the topic.

The Windows character set approach is an encoding implemented by Microsoft prior to Unicode. Each set contains 255 numbered spots that map to the glyphs in the particular set. A standard set of alphanumeric, symbol and control characters occupy the the first 128 positions. Additionally, Microsoft provides tables, hosted at unicode.org,  that map each character to its associated Unicode value. For example, the Windows Hebrew character set maps the Hebrew letter bet in slot 225 to code point 0x05D1 in Unicode. Printer’s Apprentice uses the Unicode values to draw glyphs on screen and on paper.

With Printer’s Apprentice, I chose to mimic the display of the Windows Character Map (charmap.exe) utility. This app displays glyphs using the full Unicode range, Unicode subsets and Windows Character sets.

charmap charmap2

 

This build, 8.0.22, uses the character set approach to group and display glyphs within a font. Eventually I will support full Unicode & Unicode subset displays. By using the Windows character sets, I minimized the changes to the existing code. It also meant that I did not have to design new printed sample sheets for the charts. The existing printed sample sheets work very will with non-Western sets.

One important note – internally, Printer’s Apprentice is a fully Unicode-based application. Strings in Microsoft’s .NET platform are represented as collections of Unicode characters which makes it easy to do the type of things I’m doing under the hood.

And in these example screen shots, I use Cyrillic. But Printer’s Apprentice supports the single byte character sets listed below. (Other sets and Unicode ranges are planned!)

When Printer’s Apprentice starts, it attempts to determine the locale that you are running. For example, if you are running a localized Russian version of Windows, PA will automatically default to displaying the Cyrillic character set.

You will notice the following minor changes in the user interface:

  • The Single Character and Character Set tabs display the ANSI and Unicode values in the upper right hand corner. You can toggle their display using the Options screen.
  • The current character set in use is displayed in the blue title bar in the upper right hand corner. It is a hotlink that will open the Options screen.
charset-cy charset-cy2

 

To change the change the character set being used, select Options from the Tools menu or click the set name in the blue title bar. This opens the Options dialog box where you can change the current character set. Also note the new sizes for the Character Set grid.

options gridsize

 

I also added support for printing the new character sets. So if Cyrillic is currently selected, you can print sheets that look like the sample below. The current character set name has also been added to the pages in the upper right hand corner. If you want to print a different set just click the Options tab on the Print dialog.

print1 print2

As always, we encourage feedback on how features are implemented in Printer’s Apprentice. Feel free to comment in the blog or shoot an email to helpdesk at lose your mind dot com. — Bryan

Posted in Printer's Apprentice, Programming, Windows | 1 Comment »

Printer’s Apprentice 8.0 – Character Sets

October 3rd, 2008 by Bryan Kinkel

Printer’s Apprentice 8.0, our font manager for Windows Vista & XP, has been out for a little over three weeks now. But I’m continuing work on new features.

If you take a look at the 8.0 Roadmap, you will see an entry for Unicode support. Since the early days, Printer’s Apprentice has only supported the Windows ANSI character set. Even the lowly charmap.exe application displays character sets and Unicode. Time to get that feature knocked off the To Do list.

This week I drafted out a plan for character sets & Unicode support. This touches on a couple of areas in Printer’s Apprentice:

  • The Single Character & Character Set tabs need to support slots 1-255 in any character set, not just Windows ANSI. They also need to support displaying the 65,000+ characters available in Unicode.
  • The Character Set tab itself is not as fast as I would like. It is a tad sluggish on redraw. Some working is needed here.
  • The printed Character Set sample sheets are Windows ANSI only. So these need to be retooled.

Printer's Apprentice 8.0 - Character Set tab I decided to start with the Character Set tab. This tab is actually a user control comprised of a .NET TableLayoutPanel that loads in a grid of surfaces used to draw each character (shown at the right). It is not very efficient. In a 4×4 grid, there are 16 different canvas surfaces loaded into memory. It would be faster to use a single canvas and do all the line drawing and text rendering myself.

I started a new project in Visual Studio 2005 and went to work. The goal was to build a new control that I could drop into the Printer’s Apprentice 8.0 codebase with minimal disruption. I duplicated all the properties, events and methods so it would be 100% compatible with the calling form.

Eventually I came up with something that looked very much like the Windows charmap.exe application. The image below, on the left, shows the first version of the map. The canvas is hosted inside an auto scrolling panel. The canvas is physically as “tall” as required to display 255 characters in a grid. It also supports additional character maps.

This version has two problems. I like the vertical scroll bar, but using this would require reworking of the Printer’s Apprentice UI. The host tab uses a horizontal slider below the grid to scroll through the character set. It is also not a virtual grid. In other words, all 255 characters are drawn on the canvas at once. That is fine for 255 characters, but creating a full sized canvas to hold 65,000+ Unicode characters would not be very efficient.

The second draft, below on the right, uses a virtual grid. Only the characters that are visible are actually on the canvas. If you are displaying a 5×5 grid, then the canvas is only as large as it needs to be to display those 25 characters. It uses a horizontal trackbar below the grid to scroll through the characters. Also note that this image is displaying characters from the Arabic set. Excellent!

New character grid - draft 1  New character grid - draft 2

Now that the character map control has been prototyped, it was very easy to drop it into the Printer’s Apprentice solution. Since the control handles all the drawing itself, it is much faster. I expanded the Character Set grid size option to allow for 20×20 grids. Here is a work in progress shot showing a 15×15 grid of Wingdings.

Printer's Apprentice - enhanced character set 

The new grid also supports alternate character sets. But I’m trying to figure out where to incorporate that option into the user interface. Once I get that sorted out, I’m going to add character set support to the the printed page and see what we can do about Unicode.

Any comments? Shoot them over to Bryan helpdesk at loseyourmind dot com. — BTK

Posted in Fonts, Printer's Apprentice, Programming | No Comments »