MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Bug in ExportString?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg87379] Re: Bug in ExportString?
  • From: "Fred Klingener" <gigabitbucket at gmail.com>
  • Date: Wed, 9 Apr 2008 05:53:59 -0400 (EDT)
  • References: <ftfeeg$bqh$1@smc.vnet.net>
  • Reply-to: "Fred Klingener" <gigabitbucket at gmail.com>

"P_ter" <petervansummeren at gmail.com> wrote in message 
news:ftfeeg$bqh$1 at smc.vnet.net...
>I did not formulate a good question about:
> ImportString[ExportString[" ", "PDF"], "PDF"]
> My point is that this gives an image, while
> ImportString[ExportString["t", "PDF"], "PDF"]
> gives with Inputform a polygon.
> I think a space is also text (" "). It has an ASCII place. So, there 
> should be no difference in structure with the letter t.

Here's my take:

Doing first
img = First@ImportString[ExportString[" ", "PDF"], "PDF"]

and looking at img//InputForm shows img to be a Graphics with no displayed 
object but an ImageSize of {6, 12} (presumably printer's points).

You can convince yourself of this by looking at:

Framed[img]

Compare this to

imgM = First[ImportString[ExportString["M", "PDF"], "PDF"]]

and imgM//InputForm shows a Graphics[] of the same size with a Polygon 
specification to represent the image of the character.

So the form offers the prospect of doing primitive composition with 
something like

imgList = (First@First[ImportString[ExportString[#, "PDF"], "PDF"]]) & /@ 
Characters["Mathematica"];
Graphics[Table[Translate[imgList[[i]], {6 (i - 1), 0}], {i, 
Length[imgList]}]]

The uniform Translate inside a Table seems to work well enough for 
monospaced fonts (and you can probably obfuscate the code and otherwise show 
off with the corresponding Nest construct), and a separate rendering of each 
character would seem to be a useful approach if you're on your way to 
mapping text onto a curved surface.

The "PDF" I/O form evidently uses long straight lines where possible in its 
rendering of many popular fonts. These lines won't map properly onto a 
curved surface, so they'll have to be filled in with interpolated points 
before transformation.

So the conclusions seem to be that the idiom produces consistent results 
with a variety of characters, but, because the returned images are the same 
size, compositions or typesetting probably won't look right unless you use 
monospaced fonts or your Translate values come .

Hth,
Fred Klingener



  • Prev by Date: Re: Dynamic
  • Next by Date: Re: Dynamic
  • Previous by thread: Re: Bug in ExportString?
  • Next by thread: Re: Bug in ExportString?