[geany/geany] 410fc5: Fixed issues pointed out by b4n in pull request #407 comments
Pedro Henrique Antunes de Oliveira
git-noreply at xxxxx
Fri Aug 9 07:11:59 UTC 2019
Branch: refs/heads/fractional_fonts
Author: Pedro Henrique Antunes de Oliveira <phao1989 at gmail.com>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Fri, 09 Aug 2019 07:11:59 UTC
Commit: 410fc565968333c60b9c74e1c5a0b8fbe1e42d4a
https://github.com/geany/geany/commit/410fc565968333c60b9c74e1c5a0b8fbe1e42d4a
Log Message:
-----------
Fixed issues pointed out by b4n in pull request #407 comments
Modified Paths:
--------------
src/editor.c
src/sciwrappers.c
src/sciwrappers.h
Modified: src/editor.c
7 lines changed, 4 insertions(+), 3 deletions(-)
===================================================================
@@ -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 = (100*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_fract(editor->sci, style, font_name, size/100.0);
+ sci_set_font_fract(editor->sci, style, font_name, size);
g_free(font_name);
Modified: src/sciwrappers.c
6 lines changed, 3 insertions(+), 3 deletions(-)
===================================================================
@@ -944,11 +944,11 @@ gint sci_find_text(ScintillaObject *sci, gint flags, struct Sci_TextToFind *ttf)
* @param style The style.
* @param font The font name.
* @param size The font (fractional) size. */
-void sci_set_font_fract(ScintillaObject *sci, gint style, const gchar *font, double size)
+void sci_set_font_fract(ScintillaObject *sci, gint style, const gchar *font, gdouble size)
{
SSM(sci, SCI_STYLESETFONT, (uptr_t) style, (sptr_t) font);
- // Adding 0.5 is to round.
+ // Adding 0.5 is for rounding.
SSM(sci, SCI_STYLESETSIZEFRACTIONAL, (uptr_t) style, 100.0*size + 0.5);
}
@@ -960,7 +960,7 @@ void sci_set_font_fract(ScintillaObject *sci, gint style, const gchar *font, dou
GEANY_API_SYMBOL
void sci_set_font(ScintillaObject *sci, gint style, const gchar *font, gint size)
{
- sci_set_font_fract(sci, style, font, size);
+ sci_set_font_fract(sci, style, font, size);
}
Modified: src/sciwrappers.h
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -80,7 +80,7 @@ gchar sci_get_char_at (ScintillaObject *sci, gint pos);
void sci_scroll_caret (ScintillaObject *sci);
gint sci_find_text (ScintillaObject *sci, gint flags, struct Sci_TextToFind *ttf);
-void sci_set_font_fract (ScintillaObject *sci, gint style, const gchar *font, double size);
+void sci_set_font_fract (ScintillaObject *sci, gint style, const gchar *font, double size);
void sci_set_font (ScintillaObject *sci, gint style, const gchar *font, gint size);
void sci_goto_line (ScintillaObject *sci, gint line, gboolean unfold);
gint sci_get_style_at (ScintillaObject *sci, gint position);
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list