[evince/gnome-3-36] dvi: Fix some math fonts when using virtual fonts



commit 8c485c73e5bafb2df8d0b77e4aa9d4474f220ecb
Author: David C. Sterratt <david c sterratt ed ac uk>
Date:   Sat Aug 15 12:36:02 2020 +0100

    dvi: Fix some math fonts when using virtual fonts
    
    Virtual fonts that have three or more mappings, e.g. zptmcm7y.vf and
    mdugmri7m.vf, do not display properly, giving warnings like:
    
    /home/me/test/evince-mdugmri7m.dvi[0]: Error: font 1 is not defined
    /home/me/test/evince-mdugmri7m.dvi[0]: Warning: mdugmri7m: vf macro
      had errors
    
    This commit fixes the logic by which vf_load_font() creates a
    DviFont* containing a linked list of DviFontRef*s. In an example with
    3 fonts it contained references to font 0 and font 2, but not font
    1. The pointer to font 1 was being overwritten by font 2 because the
    DviFont* last was not set to the current ref at the end of each
    iteration of the main loop. This commit fixes the problem by setting
    last to ref.
    
    Fixes #53

 backend/dvi/mdvi-lib/vf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/backend/dvi/mdvi-lib/vf.c b/backend/dvi/mdvi-lib/vf.c
index a5ae3bbe..ddf6fa83 100644
--- a/backend/dvi/mdvi-lib/vf.c
+++ b/backend/dvi/mdvi-lib/vf.c
@@ -134,8 +134,10 @@ static int vf_load_font(DviParams *params, DviFont *font)
                mdvi_free(name);
                if(last == NULL)
                        font->subfonts = last = ref;
-               else
+               else {
                        last->next = ref;
+                       last = ref;
+               }
                ref->next = NULL;
                op = fuget1(p);
        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]