parent
7214a646f8
commit
46d5e7542b
|
@ -4591,19 +4591,20 @@ void editor_ensure_final_newline(GeanyEditor *editor)
|
|||
|
||||
void editor_set_font(GeanyEditor *editor, const gchar *font)
|
||||
{
|
||||
gint style, size;
|
||||
gint style;
|
||||
gchar *font_name;
|
||||
PangoFontDescription *pfd;
|
||||
gdouble size;
|
||||
|
||||
g_return_if_fail(editor);
|
||||
|
||||
pfd = pango_font_description_from_string(font);
|
||||
size = pango_font_description_get_size(pfd) / PANGO_SCALE;
|
||||
size = pango_font_description_get_size(pfd) / (gdouble) PANGO_SCALE;
|
||||
font_name = g_strdup_printf("!%s", pango_font_description_get_family(pfd));
|
||||
pango_font_description_free(pfd);
|
||||
|
||||
for (style = 0; style <= STYLE_MAX; style++)
|
||||
sci_set_font(editor->sci, style, font_name, size);
|
||||
sci_set_font_fractional(editor->sci, style, font_name, size);
|
||||
|
||||
g_free(font_name);
|
||||
|
||||
|
|
|
@ -939,6 +939,18 @@ gint sci_find_text(ScintillaObject *sci, gint flags, struct Sci_TextToFind *ttf)
|
|||
return (gint) SSM(sci, SCI_FINDTEXT, (uptr_t) flags, (sptr_t) ttf);
|
||||
}
|
||||
|
||||
/* * Sets the font for a particular style.
|
||||
* @param sci Scintilla widget.
|
||||
* @param style The style.
|
||||
* @param font The font name.
|
||||
* @param size The font (fractional) size. */
|
||||
void sci_set_font_fractional(ScintillaObject *sci, gint style, const gchar *font, gdouble size)
|
||||
{
|
||||
SSM(sci, SCI_STYLESETFONT, (uptr_t) style, (sptr_t) font);
|
||||
|
||||
/* Adding 0.5 is for rounding. */
|
||||
SSM(sci, SCI_STYLESETSIZEFRACTIONAL, (uptr_t) style, (sptr_t) (SC_FONT_SIZE_MULTIPLIER * size + 0.5));
|
||||
}
|
||||
|
||||
/** Sets the font for a particular style.
|
||||
* @param sci Scintilla widget.
|
||||
|
@ -948,8 +960,7 @@ gint sci_find_text(ScintillaObject *sci, gint flags, struct Sci_TextToFind *ttf)
|
|||
GEANY_API_SYMBOL
|
||||
void sci_set_font(ScintillaObject *sci, gint style, const gchar *font, gint size)
|
||||
{
|
||||
SSM(sci, SCI_STYLESETFONT, (uptr_t) style, (sptr_t) font);
|
||||
SSM(sci, SCI_STYLESETSIZE, (uptr_t) style, size);
|
||||
sci_set_font_fractional(sci, style, font, size);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -216,6 +216,8 @@ gint sci_text_width (ScintillaObject *sci, gint styleNumber, const gchar *
|
|||
void sci_move_selected_lines_down (ScintillaObject *sci);
|
||||
void sci_move_selected_lines_up (ScintillaObject *sci);
|
||||
|
||||
void sci_set_font_fractional (ScintillaObject *sci, gint style, const gchar *font, gdouble size);
|
||||
|
||||
#endif /* GEANY_PRIVATE */
|
||||
|
||||
G_END_DECLS
|
||||
|
|
Loading…
Reference in New Issue