Hi Brendon,

it's an interesting problem. I could reproduce it on a fresh Ubuntu 16.04 
install (which I was about to setup for myself anyway). It turns out that for 
that case a virtual font within a virtual font is to be used, which PyX didn't 
support yet. Adding it was surprisingly easy, please find by fix in changeset 
3678. This resolves the issue for me, it probably does so for you as well.

Best,


André

Am 06.05.2016 um 19:38 schrieb Brendon Higgins <[email protected]>:

> Hi list,
> 
> I can't make heads nor tails of this weird problem I'm seeing while trying to 
> use newtx fonts. Here's a minimized example that causes the problem for me:
> 
> from pyx import *
> text.set(cls=text.LatexRunner)
> text.preamble(r'''\usepackage{newtxtext,newtxmath}''')
> c = canvas.canvas()
> c.text(0, 0, r"Remove the period to make this work: $12.45$")
> c.writePDFfile("test")
> 
> If I run this, at the final line I get "RuntimeError: missing font 
> information 
> for 'txmi'; check fontmapping file(s)". If I remove the period, everything 
> works great - no problem with numbers. It also works fine if I don't use math 
> mode. I did notice that if I replace the numbers with "$\alpha$" the problem 
> comes back, but I haven't found a pattern to the behaviour (e.g. "$\in$" is 
> fine).
> 
> Perhaps it's just my installation/distribution that has a problem. (I'm using 
> Debian testing, for what it's worth.) The error message says "check 
> fontmapping file(s)", but I have no clue where to start! I'm already in way 
> over my head with TeX's font system, so insight is much appreciated. :)
> 
> Peace,
> Brendon
> 
> ------------------------------------------------------------------------------
> Find and fix application performance issues faster with Applications Manager
> Applications Manager provides deep performance insights into multiple tiers of
> your business applications. It resolves application problems quickly and
> reduces your MTTR. Get your free trial!
> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
> _______________________________________________
> PyX-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pyx-user


-- 
by  _ _      _    Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim
   / \ \    / )   [email protected], http://www.wobsta.de/
  / _ \ \/\/ /    PyX - High quality PostScript and PDF figures
 (_/ \_)_/\_/     with Python & TeX: visit http://pyx.sourceforge.net/
--- Begin Message ---
Revision: 3678
          https://sourceforge.net/p/pyx/code/3678/
Author:   wobsta
Date:     2016-05-07 21:48:20 +0000 (Sat, 07 May 2016)
Log Message:
-----------
add support for virtual fonts in virtual fonts

Modified Paths:
--------------
    trunk/pyx/CHANGES
    trunk/pyx/pyx/dvi/vffile.py

Modified: trunk/pyx/CHANGES
===================================================================
--- trunk/pyx/CHANGES   2016-02-13 00:25:54 UTC (rev 3677)
+++ trunk/pyx/CHANGES   2016-05-07 21:48:20 UTC (rev 3678)
@@ -1,6 +1,7 @@
 0.15 (2016/xx/xx):
   - text module:
     - improve error handling when input cannot be encoded by texenc
+    - add support for virtual fonts in virtual fonts
 
 0.14.1 (2015/11/02):
   - distribution:

Modified: trunk/pyx/pyx/dvi/vffile.py
===================================================================
--- trunk/pyx/pyx/dvi/vffile.py 2016-02-13 00:25:54 UTC (rev 3677)
+++ trunk/pyx/pyx/dvi/vffile.py 2016-05-07 21:48:20 UTC (rev 3678)
@@ -79,9 +79,13 @@
                 #        (fontname, self.scale, self.ds, s, reals)
                 #        )
 
-                # XXX allow for virtual fonts here too
+                from pyx import config
                 from . import texfont
-                self.fonts[num] =  texfont.TeXfont(fontname, c, reals, d, 
self.tfmconv, self.pyxconv, self.debug > 1)
+                try:
+                    with config.open(fontname, [config.format.vf]) as fontfile:
+                        self.fonts[num] = texfont.virtualfont(fontname, 
fontfile, c, reals, d, self.tfmconv, self.pyxconv, self.debug>1)
+                except EnvironmentError:
+                    self.fonts[num] = texfont.TeXfont(fontname, c, reals, d, 
self.tfmconv, self.pyxconv, self.debug>1)
             elif cmd == _VF_LONG_CHAR:
                 # character packet (long form)
                 pl = afile.readuint32()   # packet length


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
PyX-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-checkins

--- End Message ---

Attachment: smime.p7s
Description: S/MIME cryptographic signature

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user

Reply via email to