Ben Langhinrichs

Photograph of Ben Langhinrichs

E-mail address - Ben Langhinrichs






April, 2011
SMTWTFS
     01 02
03 04 05 06 07 08 09
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

Search the weblog





























Genii Weblog


Civility in critiquing the ideas of others is no vice. Rudeness in defending your own ideas is no virtue.


Fri 29 Apr 2011, 12:11 AM
While working up a demo of some of the features that our coming version of CoexEdit offers with the new discussion template in 8.5.2, I decided that at least one feature could be implemented by anybody, whether or not they have CoexEdit. This is the issue of using point sizes in CKEditor, the editor that ships with 8.5.2 to handle rich text editing on the web.

The problem (at least I see it as such) is that the default font sizes in this CKEditor implementation is in pixels, not in points. While that may be comfortable for web designers, the vast majority of people writing in rich text fields are NOT web developers. Let's review:

  • Lotus Notes client - font size measured in point sizes (every release from beginning to present)
  • Microsoft Word - font size measured in point sizes (every release from beginning to present)
  • OpenOffice - font size measured in point sizes (every release from beginning to present)
  • Virtually any other word processor/editor - font size measured in point sizes

There might be trend. Therefore, it might surprise you when you set the size in the new discussion db from the web, and think you have set it to 14pt, that you have really set it to 14px, which is about 11pt.

Fortunately, there is a simple fix. Currently, you need to apply it to every rich text control (or change your CKEditorWrapper.js file), although I am working on a more elegant solution. All you need to do is go to the rich text control inside your Custom Control or XPage. In the image below, I modify the mainTopic Custom Control for the standard discussion. Add a dojoAttribute called fontSize_sizes with a value of 8pt;10pt;12pt;14pt;18pt;32pt or whatever point sizes you want to be available.  After that, the point sizes will be available and work.  If you want to give users the option of using point of pixel sizes, I recommend using something like
8pt;9pt;10pt;12pt;14pt;18pt;32pt;8px;9px;10px;11px;12px;14px;16px;18px;32px

which will explicitly show the pt or px, as well as show the text in the size desired.


Out of the box implementation:




Fix needed:





After fix:




Copyright © 2011 Genii Software Ltd.

Tags: