Version 4 (modified by nenko, 16 years ago) (diff) |
---|
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.
Related
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.
Implementation
(Describe and link the implementation results here (from the wiki or the repository).)
Testing
(Place the testing results here.)
Comments
(Write comments for this or later revisions here.)