Daniel Luecking | 1 Mar 2009 01:41
Picon
Favicon

Re: extract names of glyphs in font?


----- Original Message -----
From: Steve White <stevan.white <at> googlemail.com>
Date: Saturday, February 28, 2009 12:20 pm
Subject: [metapost] extract names of glyphs in font?
To: metapost <at> tug.org

> Hi,
> 
> I'm extracting glyphs from a font (Yannis Haralambous' Sinhala) using
> commands such as
>      mpost '&./mfplain \mag=83.82; mode:=localfont; filenametemplate
> "%j-%4c.eps"; input sinha12.mf'
> This works pretty well, but I want more:
> I can see the names of the glyphs in the .mf files:  the code for the
> glyph named "aa" starts with
>    xbeginchar(oct"020",12.8FX#,18.9FY#,6.3FY#); "aa";
...
> Is there any way in MetaPost to represent that string in the EPS file?
> (It could be either within the file or in the file name.)

In metaFONT, a bare string expression is a "title" and would appear on the 
terminal if tracingtitles>0. It would also be in the tfm file if proofing > 0. 
I don't know exactly what is done with titles in metaPOST, as they are only 
briefly mentioned under tracingtitles. I'm guessing MP does nothing with 
them except display them on screen when tracingtitles > 0.

Your only hope would seem to be to search for them and incorporate them
into a command that does what you want, such as write a special to the 
output file.
(Continue reading)

Steve White | 1 Mar 2009 11:26

Re: extract names of glyphs in font?

Hi, Daniel,

On Sun, Mar 1, 2009 at 1:41 AM, Daniel Luecking <luecking <at> uark.edu> wrote:
>
> ----- Original Message -----
> From: Steve White <stevan.white <at> googlemail.com>
>>
>> I'm extracting glyphs from a font (Yannis Haralambous' Sinhala) using
>> commands such as
>>      mpost '&./mfplain \mag=83.82; mode:=localfont; filenametemplate
>> "%j-%4c.eps"; input sinha12.mf'
>> This works pretty well, but I want more:
>> I can see the names of the glyphs in the .mf files:  the code for the
>> glyph named "aa" starts with
>>    xbeginchar(oct"020",12.8FX#,18.9FY#,6.3FY#); "aa";
> ...
>> Is there any way in MetaPost to represent that string in the EPS file?
>> (It could be either within the file or in the file name.)
>
> In metaFONT, a bare string expression is a "title" and would appear on the
> terminal if tracingtitles>0. It would also be in the tfm file if proofing > 0.
> I don't know exactly what is done with titles in metaPOST, as they are only
> briefly mentioned under tracingtitles. I'm guessing MP does nothing with
> them except display them on screen when tracingtitles > 0.
>
I tried inserting
     tracingtitles:=1;
into my mpost command (is this what you meant?).  It had no effect I
could see, on the command output, or on the output files.

(Continue reading)

Jesús Guillermo Andrade | 19 Mar 2009 17:36
Favicon
Gravatar

Problem with simulated gradient

Dear Fellows: I´ve been working over this problem for a long time and so far I haven't got the desired results. I need to create a linear gradient (or at least simulate it) from left to right in a polygon. I don't want to use metafun and the problem is how to fake it in eps. I am in urgent need for a solution and I don´t have anyone to ask for help excepto for this list. Could anybody help me please?
This is code I have so far:

% A&M Logo
% Por Guillermo Andrade
% -------------------------------
% Preparacion
prologues:=3;
filenametemplate "%j-%3c.eps";
fontmapfile "pdftex_dl14.map";
input mp-tool;
input mp-spec ;

u=1cm;
% Variables
color c[];
% Funciones

% Dibujos
beginfig(1);
  path eme; % this is the polygon I need filled with a simulated gradient from one color to another (horizontally).
  eme = (-2.4u,6.2u)--(-4.5u,6.2u)--(-5.9u,0u)--(-4.15u,5.28u)--(-5.25u,0u)--(-3.8u,4.389u)--(-3.7u,4.134u)--(-4.6u,0u)--(-3.45u,3.485u)--(-3.30u,3.1u)--(-3.95u,0u)--(-3.15u,2.71u)--(-2.1u,0u)--(0,0)--(0.81u,2.97u)--(2.0u,0u)--(4.10u,0u)--(1.7u,6.2u)--(-0.49u,6.2u)--(-1.38u,3.58u)--cycle;
%%% Relleno
  s := .1;
  alt:= 6.2u;
  lateral:= -6u;
for i=0 step s until 200:
  fill eme shifted (-6u+i,0) withcmykcolor (i/100)[(1,0.60,.60,0),(1,1,1,1)];
endfor;
endfig;
end;

Thanks a lot for you help.!!! 

Los errores indetectables son infinitos en su variedad, en cambio los detectables por definición son limitados. Tercera Ley de fiabilidad de Gilb.
------------------------------
Jesús Guillermo Andrade (Abg.)
Gerente de Litigios y Corporativo. EDM. AC. API.
Andrade & Moreno S.C. (http://amlegal.wordpress.com/)

--
http://tug.org/metapost/
Taco Hoekwater | 19 Mar 2009 18:27
Gravatar

Re: Problem with simulated gradient


It helps if you replace this:

> for i=0 step s until 200:
>   fill eme shifted (-6u+i,0) withcmykcolor 
> (i/100)[(1,0.60,.60,0),(1,1,1,1)];
> endfor;

by:

   path sq;
   sq := (0,0)--(u,0)--(u,alt)--(0,alt)--cycle;
   for i=0 step s until 200:
     fill sq shifted (-6u+10i,0) withcmykcolor 
(i/100)[(1,0.60,.60,0),(1,1,1,1)];
   endfor;
   clip currentpicture to eme;

This fills 200 shifted copies of a small rectangle, and then
uses the actual logo as a clip mask.

Best wishes,
Taco
--
http://tug.org/metapost/

Troy Henderson | 19 Mar 2009 19:09
Picon

Re: Problem with simulated gradient

>   sq := (0,0)--(u,0)--(u,alt)--(0,alt)--cycle;

or even

sq:=unitsquare xscaled u yscaled alt;

Troy
--
http://tug.org/metapost/

Jesús Guillermo Andrade | 19 Mar 2009 21:17
Favicon
Gravatar

Re: Problem with simulated gradient

Many Thanks Troy. I have made the changes you kindly suggested and now I understand better the logic of it all. That being said, however, I can notice that the gradation does not reach the full black extreme color  to the right of the "eme" polygon (it shows as a mild greyish--blue). Is there a reason for this? Perhaps its best to change the size of the square used for the coloring, or should it be better to reduce the amount of the shift? 
The idea would be to begin with any given color in the leftmost part of the polygon and have it full black to the left.

Thanks again man.
%CHANGE THIS?
 sq := (0,0)--(u,0)--(u,alt)--(0,alt)--cycle;
 for i=0 step s until 300:
   fill sq shifted (-6u+10i,0) OR THIS? withcmykcolor (i/100)[(1,0.60,.60,0),(1,1,1,1)];
 endfor;
 clip currentpicture to eme;



El 19/03/2009, a las 01:39 p.m., Troy Henderson escribió:

  sq := (0,0)--(u,0)--(u,alt)--(0,alt)--cycle;

or even

sq:=unitsquare xscaled u yscaled alt;

Troy



Si perdiste una revista. Tus amigos también la perdieron, no la compraron o la tiraron. Cuarta Ley de Johnson.
------------------------------
Jesús Guillermo Andrade (Abg.)
Gerente de Litigios y Corporativo. EDM. AC. API.
Andrade & Moreno S.C. (http://amlegal.wordpress.com/)

--
http://tug.org/metapost/
Troy Henderson | 19 Mar 2009 21:14
Picon

Re: Problem with simulated gradient

I made only one suggestion.  It was Taco that gave you what you were
looking for I think.  Nevertheless, I'm glad things are coming
together for you.

Troy
--
http://tug.org/metapost/

Taco Hoekwater | 19 Mar 2009 22:27
Gravatar

Re: Problem with simulated gradient

Jesús Guillermo Andrade wrote:
> The idea would be to begin with any given color in the leftmost part of 
> the polygon and have it full black to the left.
> 
> Thanks again man.
> %CHANGE THIS?

I didn't check earlier as I thought to myself that you might as
well do the calculus yourself. I just bumped the i multiplier in
the x coordinate of the shifted until it looked like there was
a visible gradient.

I had some time to spare anyway, so here is how it works /
should work.

To get the gradient to behave nicely, you have to synchronize two
things: the end of the shift (so that is coincides with the rightmost
bit of the "eme" path, which is at 4.1u), and the moment where you
fully reach the final color, which should be at the same horizontal
spot.

1. At the end of the for loop in my adjustment to you original,
   you had a total x shift of -6u+10i with i_max=200, so

     shift (-6cm + 10*200(pt),0)

   10*200pt is about 70.6cm, which makes the gradient squares
   stop at an x position of 64.6cm instead of the desired
   4.1cm.

2. The color of the gradient reaches (1,1,1,1) at half of the
   total distance, (namely at s=100), which is at an x location
   of about 29.7cm, so that was also way off.

To rectify situation 1, you have to pick an i multiplier for the x
shift that makes the shift stop at 4.1u, meaning you have to travel
10.1u inside 200 i's, so that is

   for i=0 step s until 200:
      fill sq shifted (-6u+(i/200)*10.1u,0)

To rectify 2, you have to make the color reach its terminus
at "200", so divide by that instead of by 100:

   for i=0 step s until 200:
      fill sq shifted (-6u+(i/200)*10.1u,0)
          withcmykcolor (i/200)[(1,0.60,.60,0),(1,1,1,1)];

A thing you may rethink is that s=.1 is a whole lot of steps.
Unless you plan to use the logo in a really large size, you can
set s a bit higher and the result image will be smaller on disk
and it will also be drawn quite a bit faster.

Best wishes,
Taco

--
http://tug.org/metapost/

Sebastian Waschik | 20 Mar 2009 18:21
Picon
Picon

metauml: Change font of state name

Hello,

I like to change the font of a state-box in metauml.  The problem is,
that I do not know the exact name.  Here is an example:

input metauml;

beginfig(0)
  State.A("A")();
  Class.B("B")()();

  %A.info.iText.iFont.name := metauml_defaultFontOblique;
  B.info.iName.iFont.name := metauml_defaultFontOblique;

  leftToRight(10)(A, B);

  drawObjects(A, B);
endfig;
end

After reading the source code I thought iText would be right.  But it is
not:

>> A.info.iText.iFont.name
>> "ptmro8r"
! Equation cannot be performed (numeric=string).
<to be read again> 
                   ;
l.7 ...t.iFont.name := metauml_defaultFontOblique;

I also tried: A.info.iFont.name, A.info.iName.iFont.name,
A.info.iPict.iFont.name, and several other names.

I use metauml 0.2.5 .

Greetings and TIA
Sebastian Waschik
--
http://tug.org/metapost/

Constantine | 22 Mar 2009 17:53
Picon

Run MetaPost under Windows

Hi,

I am a niewbie to Metapost and wanted to ask for your advise on how to install MetaPost under Windows XP, if that's possible. Basically, I want to
be able to write an *.mp file and be able to compile it and view the output. Is there any program that does that? I would appreciate
any suggestions.

Thanks for your help,
Constantine

--
http://tug.org/metapost/

Gmane