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

Ticket Summary Owner Status Type Component Priority Effort Importance
#905 TEXT_FONTS_INTERFACE_R0 nenko closed planned_task TEXT_FORMATTING 3 1 0

Reported by Astea, 4 years ago.

Description

wiki page: TEXT_FONTS_INTERFACE_R0 - effort: 1d

Analysis_owners

dido

Analysis_reviewers

nenko

Analysis_score

4

Design_owners

nenko

Design_reviewers

boyan

Design_score

3.5

Imp._owners

nenko, nenko, nenko

Imp._reviewers

meddle, meddle, meddle, pap, meddle, pap, meddle

Imp._score

3

Test_score

0

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.)