summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-05-23 12:00:07 +0200
committerRobin Watts <robin.watts@artifex.com>2018-06-22 16:48:46 +0100
commit40f1e72772d86aa4bf899d3f25072477c50055d7 (patch)
treeea10d99c5abd1307880ca178972ad7e080fcf9e4 /platform
parent41050d282409f86f425ac4a157fc07d889e4b54d (diff)
downloadmupdf-40f1e72772d86aa4bf899d3f25072477c50055d7.tar.xz
gl: Edit FreeText default appearance.
Diffstat (limited to 'platform')
-rw-r--r--platform/gl/gl-annotate.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/platform/gl/gl-annotate.c b/platform/gl/gl-annotate.c
index f23de5ba..35fbc766 100644
--- a/platform/gl/gl-annotate.c
+++ b/platform/gl/gl-annotate.c
@@ -371,6 +371,7 @@ static const char *line_ending_styles[] = {
"None", "Square", "Circle", "Diamond", "OpenArrow", "ClosedArrow", "Butt",
"ROpenArrow", "RClosedArrow", "Slash" };
static const char *quadding_names[] = { "Left", "Center", "Right" };
+static const char *font_names[] = { "Cour", "Helv", "TiRo", "Symb", "ZaDb", };
static int should_edit_border(enum pdf_annot_type subtype)
{
@@ -514,11 +515,38 @@ void do_annotate_panel(void)
if (subtype == PDF_ANNOT_FREE_TEXT)
{
+ int font_choice, color_choice, size_changed;
int q = pdf_annot_quadding(ctx, selected_annot);
+ const char *text_font;
+ static float text_size_f, text_color[3];
+ static int text_size;
ui_label("Text Alignment:");
choice = ui_select("Q", quadding_names[q], quadding_names, nelem(quadding_names));
if (choice != -1)
pdf_set_annot_quadding(ctx, selected_annot, choice);
+
+ pdf_annot_default_appearance(ctx, selected_annot, &text_font, &text_size_f, text_color);
+ text_size = text_size_f;
+
+ ui_label("Text Font:");
+ font_choice = ui_select("DA/Font", text_font, font_names, nelem(font_names));
+ ui_label("Text Size: %d", text_size);
+ size_changed = ui_slider(&text_size, 8, 36, 256);
+ ui_label("Text Color:");
+ color_choice = ui_select("DA/Color", name_from_hex(hex_from_color(3, text_color)), color_names+1, nelem(color_names)-1);
+ if (font_choice != -1 || color_choice != -1 || size_changed)
+ {
+ if (font_choice != -1)
+ text_font = font_names[font_choice];
+ if (color_choice != -1)
+ {
+ text_color[0] = ((color_values[color_choice+1]>>16) & 0xff) / 255.0f;
+ text_color[1] = ((color_values[color_choice+1]>>8) & 0xff) / 255.0f;
+ text_color[2] = ((color_values[color_choice+1]) & 0xff) / 255.0f;
+ }
+ pdf_set_annot_default_appearance(ctx, selected_annot, text_font, text_size, text_color);
+ }
+ ui_spacer();
}
if (subtype == PDF_ANNOT_LINE)