[NTG-context] I could use some ideas for a strategy to get these kind of labels in a METAPOST picture

2020-03-27 Thread Gerben Wierda
I have strings I get from an XML that I want to turn into labels for objects in 
a METAPOST picture (using MetaFun). These strings can have arbitrary characters 
(like accents) and some characters are coded. Examples of how these are coded:

My "Application” Fünction

[My] Application (Component)

Business  service

Besides the text, I know what the intended size (e.g. 10) and style (e.g. bold 
or italics) is.

I have the string and I have a size of a box it needs to be fitted in and I 
have set a default font. Preferably, I’d like to code these in a box of the 
aspect ratio of the box it needs to fit in. So, for instance, I have a box that 
is 50 (high) by 130 (wide) and
- if the text fits in the box, just typeset it. Break the words (yes or no)
- if the size set does not fit in the box, make it smaller so it fits. 
Initially this is optional as the boxes will be of the size in which the text 
fits.
- I might want to use some pattern to split it into multiple lines. E.g. if the 
last part of the string is “(some text)” put it on a last line by itself and if 
the first part of the string is “[some text]” put it on a first line by itself

I am using Lua to generate METAPOST which are written by ‘context’ commands.

I am not that experienced and I am looking for tips on a strategy to do this.

Thanks in advance,

G
___
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
___


Re: [NTG-context] \setupinteraction v commas

2020-03-27 Thread Pablo Rodriguez
On 3/26/20 6:54 PM, Tomas Hala wrote:
> [...]
> I would like to have commas in metadata attribute keywords
> because space is confusing -- one cannot distinguish
> a space as a separator from a space as a part of a keyword.

Hi Tomáš,

a workaround is contained in the following sample

\def\comma{‚}
\enabledirectives
[interaction.identity.preroll]

\setupinteraction
  [title={a, b, c},
   subtitle={a, b, c},
   author={a, b, c},
   keyword={a\comma\ b\comma\ c},
]

\starttext
\null
\stoptext

BTW, I’m faking the character with an opening single comma (such as the
one used in German [and probably other languages ]).

I don’t know how to insert the actual comma there, since it gets
replaced when using the command.

Just in case it might help,

Pablo
--
http://www.ousia.tk
___
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
___