ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* I (metapost) can't handle numbers bigger than 32767.99998
@ 2019-07-05  6:32 Zhichu
  2019-07-05  8:59 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Zhichu @ 2019-07-05  6:32 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: 陈之初


[-- Attachment #1.1: Type: text/plain, Size: 1206 bytes --]

Hi everyone,

I was using metapost to generate some symbols, as in "tex/texmf-context/metapost/context/fonts/mpiv/demo-symbols.tex"

Occasionally, I want to customize a glyph whose charcode is a little large, say the character "院":
========================================
~~~IPython
In [1]: for c in u'院': print(ord(c))
38498
========================================

so I wrote:
========================================
beginglyph(38498,2,4,0) ; % high voltage
    interim ahlength := 1 ;
    drawarrow (1,4) -- (0,2) -- (2,3) -- (1,0) withcolor darkred ;
endglyph ;
========================================

and I got:
========================================
! Enormous number has been reduced.
l.60 beginzhglyph(38498
);
I can't handle numbers bigger than 32767.99998;
so I've changed your constant to that maximum amount.
========================================

So charcode is a 15-bit integer?

Currently, I use `beginglyph(32767,2,4,0) ;` and call it with \char"7FFF. Not an elegant way I think.

Is there a fix? I checked the metapost manual and found that charcode is only used to set the filename to something like %{jobname}.%{charcode} I can't see why there's a limit for charcode.






[-- Attachment #1.2: Type: text/html, Size: 4273 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: I (metapost) can't handle numbers bigger than 32767.99998
  2019-07-05  6:32 I (metapost) can't handle numbers bigger than 32767.99998 Zhichu
@ 2019-07-05  8:59 ` Hans Hagen
  2019-07-05  9:42   ` Zhichu
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2019-07-05  8:59 UTC (permalink / raw)
  To: Zhichu, ntg-context@ntg.nl >> mailing list for ConTeXt users

On 7/5/2019 8:32 AM, Zhichu wrote:
> Hi everyone,
> 
> I was using metapost to generate some symbols, as in "tex/texmf-context/metapost/context/fonts/mpiv/demo-symbols.tex"

How do you use these symbols in a document? Do you call them up by 
number somehow? Using some glyph interface doesn't make much sense I 
think, as the font stuff comes from mf which is 8 bit. So, these 
character numbers (and simensions) are not really saying much, other 
than that they're properties of a figure.

(In context lmtx there will likely be some module for mp fonts. We can 
already do a lot but there is some more potential.)

Hans


> Occasionally, I want to customize a glyph whose charcode is a little large, say the character " 
> 院":
> ========================================
> ~~~IPython
> In [1]: for c in u'院': print(ord(c))
> 38498
> ========================================
> 
> so I wrote:
> ========================================
> beginglyph(38498,2,4,0) ; % high voltage
>      interim ahlength := 1 ;
>      drawarrow (1,4) -- (0,2) -- (2,3) -- (1,0) withcolor darkred ;
> endglyph ;
> ========================================
> 
> and I got:
> ========================================
> ! Enormous number has been reduced.
> l.60 beginzhglyph(38498
> );
> I can't handle numbers bigger than 32767.99998;
> so I've changed your constant to that maximum amount.
> ========================================
> 
> So charcode is a 15-bit integer?
> 
> Currently, I use `beginglyph(32767,2,4,0) ;` and call it with \char"7FFF. Not an elegant way I think.
> 
> Is there a fix? I checked the metapost manual and found that charcode is only used to set the filename to something like %{jobname}.%{charcode} I can't see why there's a limit for charcode.
> 
> 
> 
> 
> 
> 
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
> 


-- 

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re:  I (metapost) can't handle numbers bigger than 32767.99998
  2019-07-05  8:59 ` Hans Hagen
@ 2019-07-05  9:42   ` Zhichu
  0 siblings, 0 replies; 3+ messages in thread
From: Zhichu @ 2019-07-05  9:42 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 4356 bytes --]

Hi Hans,

I simply put the unicode character there and everything works pretty well.

I was using only 5 Chinese characters in a document: 中國科學院, which means Chinese Academy of Sciences. Looked up their unicode number:

for c in u'中國科學院': print(ord(c))
20013
22283
31185
23416
38498

and draw every glyph carefully in a metapost file "cas-chars.mp":

beginglyph(20013,1000,1000,0);
  % a lot of fillings and drawingsendglyph;

then call them in a test file:

\definemetafont[cas-logo][cas-chars.mp]
\startTEXpage
\definefont[cas][cas@cas-logo]
    \cas 中國科學院\stopTEXpage

If I remove the beginglyph(38498,1000,1000,0) part in the mp file and “\cas 中國科學” will generate the correct output. or if I change beginglyph(38498,1000,1000,0) to  beginglyph(32767,1000,1000,0) and “\cas 中國科學\char"7FFF” also gives the right output.

I'm looking forward to “some” module :-)
------------------------------------------------------------------
From:Hans Hagen <j.hagen@xs4all.nl>
Send Time:2019 Jul. 5 (Fri.) 17:03
To:陈之初 <chenzhichu@zjlab.org.cn>; mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject:Re: [NTG-context] I (metapost) can't handle numbers bigger than 32767.99998

On 7/5/2019 8:32 AM, Zhichu wrote:
> Hi everyone,
> 
> I was using metapost to generate some symbols, as in "tex/texmf-context/metapost/context/fonts/mpiv/demo-symbols.tex"

How do you use these symbols in a document? Do you call them up by 
number somehow? Using some glyph interface doesn't make much sense I 
think, as the font stuff comes from mf which is 8 bit. So, these 
character numbers (and simensions) are not really saying much, other 
than that they're properties of a figure.

(In context lmtx there will likely be some module for mp fonts. We can 
already do a lot but there is some more potential.)

Hans


> Occasionally, I want to customize a glyph whose charcode is a little large, say the character " 
> 院":
> ========================================
> ~~~IPython
> In [1]: for c in u'院': print(ord(c))
> 38498
> ========================================
> 
> so I wrote:
> ========================================
> beginglyph(38498,2,4,0) ; % high voltage
>      interim ahlength := 1 ;
>      drawarrow (1,4) -- (0,2) -- (2,3) -- (1,0) withcolor darkred ;
> endglyph ;
> ========================================
> 
> and I got:
> ========================================
> ! Enormous number has been reduced.
> l.60 beginzhglyph(38498
> );
> I can't handle numbers bigger than 32767.99998;
> so I've changed your constant to that maximum amount.
> ========================================
> 
> So charcode is a 15-bit integer?
> 
> Currently, I use `beginglyph(32767,2,4,0) ;` and call it with \char"7FFF. Not an elegant way I think.
> 
> Is there a fix? I checked the metapost manual and found that charcode is only used to set the filename to something like %{jobname}.%{charcode} I can't see why there's a limit for charcode.
> 
> 
> 
> 
> 
> 
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
> 


-- 

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________


[-- Attachment #1.2: Type: text/html, Size: 14621 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-05  9:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-05  6:32 I (metapost) can't handle numbers bigger than 32767.99998 Zhichu
2019-07-05  8:59 ` Hans Hagen
2019-07-05  9:42   ` Zhichu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).