wiki:TEXT_FONTS_INTERFACE_R0
Last modified 14 years ago Last modified on 06/10/09 18:16:47

Error: Macro BackLinksMenu(None) failed
compressed data is corrupt

Error: Macro TicketQuery(summary=TEXT_FONTS_INTERFACE_R0, format=table, col=summary|owner|status|type|component|priority|effort|importance, rows=description|analysis_owners|analysis_reviewers|analysis_score|design_owners|design_reviewers|design_score|implementation_owners|implementation_reviewers|implementation_score|test_owners|test_reviewers|test_score|) failed
current transaction is aborted, commands ignored until end of transaction block

Analysis

Overview

  • There should be easy way for the user to change fonts. This functionality should appear in character settings hud and detached text frame editor.
  • User should be able to chose font name(Helvetica, Arial etc.) and font face(heavy, medium, oblique, gothic, regular etc.)

Task requirements

  • Add 2 combo boxes in character settings hud and detached frame editor, one for font name and one for font face.

Task result

  • The result should be code.

Implementation idea

  • Currently we use swing-based java component for font selection(JFontChooser). See if we can use some of it's functionality.
  • You can use org.sophie2.main.view.boundcontrols.BoundComboBox
  • Use java.awt.Font to provide needed fonts data.

TEXT_CHARACTER_FORMAT_COMMONS_R0
TEXT_FONTS_SUPPORT_R0

TEXT_HALO_MENU_R0
DETACHED_TEXT_FRAME_EDITOR_R0

How to demo

  • Run the application
  • Create a new book and place text frame inside
  • Populate some lorem ipsum text inside with a number of paragraphs(lorem ipsum generator --> http://www.lipsum.com/)
  • Select part of the text, open character settings hud and change the font.

Design

New module will be created - org.sophie2.main.func.text - that will contain all frames, halos, huds etc. related to HotText. In this module a new halo menu will be created and it will contain:

  • combo box for font name

Fonts can be gathered with the following fragment:

GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();

String []fontFamilies = ge.getAvailableFontFamilyNames();

  • combo box for font size
  • toggle buttons for styling - italic, bold, underline, strikethrough

When the user select font family name, size and style, they will be added to the HotText using the Styler interface (HotText.Styler#addStyle) by using an empty HotStyleDef and derive from it the HotStyleDef that is needed (HotStyleDef.EMPTY_STYLE#derive). Then the appropriate visualization is a job of HotTextLayout.

Every single text unit (a glyph) is drawn by the Atom class. So the conversion of HotStyleDef to a java.awt.Font object should be made there.

source:trunk/sophie2-platform/doc/uml-design-diagrams/hotText/HotText - model.png

source:trunk/sophie2-platform/doc/uml-design-diagrams/hotText/HotStyleDef-model.png

source:trunk/sophie2-platform/doc/uml-design-diagrams/hotText/HotTextFontGUI.png

Implementation

Implementation is done according to the design

Also some bugs fixed:

  • when navigating through text with arrow keys now you don't get "Position not in text!" error when you are at text start and press left key

Changesets:

Merged in the trunk in [3363].

Testing

(Place the testing results here.)

Comments

(Write comments for this or later revisions here.)