commit b23e22a9270f029eca16d6a0fcb1e7dbfc36f343
parent d4ca55f0bed71061d9a966de85d2422d9b44c001
Author: Kyle Milz <krwmilz@gmail.com>
Date: Thu, 9 Mar 2023 22:16:31 +0000
cleanup in do_load_freetype_font()
- ansi function signature
- early return to reduce control flow nesting
Diffstat:
M | dvi-draw.c | | | 71 | ++++++++++++++++++++++++++++++++++++----------------------------------- |
1 file changed, 36 insertions(+), 35 deletions(-)
diff --git a/dvi-draw.c b/dvi-draw.c
@@ -792,57 +792,58 @@ set_vf_char(wide_ubyte ch)
*/
static void
-do_load_freetype_font()
+do_load_freetype_font(void)
{
- if (!load_ft_font(currinf.fontp)) {
- /* Revert to non-scalable font */
- struct ftfont *ftp;
+ struct ftfont *ftp;
- if (debug & DBG_OPEN)
+ if (load_ft_font(currinf.fontp)) {
+ currinf.set_char_p = currinf.fontp->set_char_p = set_char;
+ return;
+ }
+
+ /* Revert to non-scalable font */
+ if (debug & DBG_OPEN)
printf(
"Font %s is not loadable; reverting to non-scalable font\n",
currinf.fontp->fontname);
- ftp = currinf.fontp->ft;
- ftp->t1->bad = True;
- if (currinf.fontp == ftp->first_size) {
+ ftp = currinf.fontp->ft;
+ ftp->t1->bad = True;
+ if (currinf.fontp == ftp->first_size) {
if (currinf.fontp->next_size == NULL) {
- /* if this is the only size of this font face */
- ftp->t1->ft = NULL;
- free(ftp);
+ /* if this is the only size of this font face */
+ ftp->t1->ft = NULL;
+ free(ftp);
}
else {
- struct font *fontp2;
-
- ftp->first_size = fontp2 = currinf.fontp->next_size;
- /*
- * Opening the file might have succeeded at some other size,
- * so we need to transfer that information to the next
- * record in case it was put here.
- */
- fontp2->file = currinf.fontp->file;
- currinf.fontp->file = NULL;
- fontp2->filename = currinf.fontp->filename;
- currinf.fontp->filename = NULL;
- fontp2->timestamp = currinf.fontp->timestamp;
+ struct font *fontp2;
+
+ ftp->first_size = fontp2 = currinf.fontp->next_size;
+ /*
+ * Opening the file might have succeeded at some other size,
+ * so we need to transfer that information to the next
+ * record in case it was put here.
+ */
+ fontp2->file = currinf.fontp->file;
+ currinf.fontp->file = NULL;
+ fontp2->filename = currinf.fontp->filename;
+ currinf.fontp->filename = NULL;
+ fontp2->timestamp = currinf.fontp->timestamp;
}
- }
- else {
+ }
+ else {
struct font *fontp2;
fontp2 = ftp->first_size;
while (fontp2->next_size != currinf.fontp)
- fontp2 = fontp2->next_size;
+ fontp2 = fontp2->next_size;
fontp2->next_size = currinf.fontp->next_size;
- }
- currinf.fontp->ft = NULL;
- /* The virtual font machinery will take it from here. */
- /* That will call load_font(), but it won't take us back to the */
- /* freetype font, because that font will have been marked bad. */
- currinf.set_char_p = load_n_set_char;
}
- else
- currinf.set_char_p = currinf.fontp->set_char_p = set_char;
+ currinf.fontp->ft = NULL;
+ /* The virtual font machinery will take it from here. */
+ /* That will call load_font(), but it won't take us back to the */
+ /* freetype font, because that font will have been marked bad. */
+ currinf.set_char_p = load_n_set_char;
}
long