ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* I could use some ideas for a strategy to get these kind of labels in a METAPOST picture
@ 2020-03-28  1:01 Gerben Wierda
  2020-03-28 17:58 ` Gerben Wierda
  0 siblings, 1 reply; 6+ messages in thread
From: Gerben Wierda @ 2020-03-28  1:01 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

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

* Re: I could use some ideas for a strategy to get these kind of labels in a METAPOST picture
  2020-03-28  1:01 I could use some ideas for a strategy to get these kind of labels in a METAPOST picture Gerben Wierda
@ 2020-03-28 17:58 ` Gerben Wierda
  2020-03-28 18:04   ` Wolfgang Schuster
  0 siblings, 1 reply; 6+ messages in thread
From: Gerben Wierda @ 2020-03-28 17:58 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Actually, I would already be helped with a way to convert this string:

	My “Büsiness" & sérvice

into something that can be typeset by ConTeXt. Using embedded lua is fine.

G

> On 28 Mar 2020, at 02:01, Gerben Wierda <gerben.wierda@rna.nl> wrote:
> 
> 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 &amp; 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
> ___________________________________________________________________________________

___________________________________________________________________________________
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] 6+ messages in thread

* Re: I could use some ideas for a strategy to get these kind of labels in a METAPOST picture
  2020-03-28 17:58 ` Gerben Wierda
@ 2020-03-28 18:04   ` Wolfgang Schuster
  2020-03-29  8:47     ` Gerben Wierda
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Schuster @ 2020-03-28 18:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Gerben Wierda

Gerben Wierda schrieb am 28.03.2020 um 18:58:
> Actually, I would already be helped with a way to convert this string:
> 
> 	My “Büsiness" &amp; sérvice
> 
> into something that can be typeset by ConTeXt. Using embedded lua is fine.

Does enabling entities help?

\setupxml
   [entities=yes]

Wolfgang
___________________________________________________________________________________
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] 6+ messages in thread

* Re: I could use some ideas for a strategy to get these kind of labels in a METAPOST picture
  2020-03-28 18:04   ` Wolfgang Schuster
@ 2020-03-29  8:47     ` Gerben Wierda
  2020-03-29 10:44       ` Gerben Wierda
  2020-03-29 12:00       ` Wolfgang Schuster
  0 siblings, 2 replies; 6+ messages in thread
From: Gerben Wierda @ 2020-03-29  8:47 UTC (permalink / raw)
  To: Wolfgang Schuster; +Cc: mailing list for ConTeXt users



> On 28 Mar 2020, at 19:04, Wolfgang Schuster <wolfgang.schuster.lists@gmail.com> wrote:
> 
> Gerben Wierda schrieb am 28.03.2020 um 18:58:
>> Actually, I would already be helped with a way to convert this string:
>> 	My “Büsiness" &amp; sérvice
>> into something that can be typeset by ConTeXt. Using embedded lua is fine.
> 
> Does enabling entities help?
> 
> \setupxml
>  [entities=yes]

This is not in the manual. Is it documented somewhere?

G

> 
> Wolfgang

___________________________________________________________________________________
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] 6+ messages in thread

* Re: I could use some ideas for a strategy to get these kind of labels in a METAPOST picture
  2020-03-29  8:47     ` Gerben Wierda
@ 2020-03-29 10:44       ` Gerben Wierda
  2020-03-29 12:00       ` Wolfgang Schuster
  1 sibling, 0 replies; 6+ messages in thread
From: Gerben Wierda @ 2020-03-29 10:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users

I tried this and it worked. 

Next issue: if the string has a “ character in it, METAPOST cannot handle it. New question for the list...

G

> On 29 Mar 2020, at 10:47, Gerben Wierda <gerben.wierda@rna.nl> wrote:
> 
> 
> 
>> On 28 Mar 2020, at 19:04, Wolfgang Schuster <wolfgang.schuster.lists@gmail.com> wrote:
>> 
>> Gerben Wierda schrieb am 28.03.2020 um 18:58:
>>> Actually, I would already be helped with a way to convert this string:
>>> 	My “Büsiness" &amp; sérvice
>>> into something that can be typeset by ConTeXt. Using embedded lua is fine.
>> 
>> Does enabling entities help?
>> 
>> \setupxml
>> [entities=yes]
> 
> This is not in the manual. Is it documented somewhere?
> 
> G
> 
>> 
>> Wolfgang
> 
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________

___________________________________________________________________________________
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] 6+ messages in thread

* Re: I could use some ideas for a strategy to get these kind of labels in a METAPOST picture
  2020-03-29  8:47     ` Gerben Wierda
  2020-03-29 10:44       ` Gerben Wierda
@ 2020-03-29 12:00       ` Wolfgang Schuster
  1 sibling, 0 replies; 6+ messages in thread
From: Wolfgang Schuster @ 2020-03-29 12:00 UTC (permalink / raw)
  To: Gerben Wierda; +Cc: mailing list for ConTeXt users

Gerben Wierda schrieb am 29.03.2020 um 10:47:
> 
> 
>> On 28 Mar 2020, at 19:04, Wolfgang Schuster <wolfgang.schuster.lists@gmail.com> wrote:
>>
>> Gerben Wierda schrieb am 28.03.2020 um 18:58:
>>> Actually, I would already be helped with a way to convert this string:
>>> 	My “Büsiness" &amp; sérvice
>>> into something that can be typeset by ConTeXt. Using embedded lua is fine.
>>
>> Does enabling entities help?
>>
>> \setupxml
>>   [entities=yes]
> 
> This is not in the manual. Is it documented somewhere?

I added it to the syntax of the \setupxml command.

Wolfgang
___________________________________________________________________________________
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] 6+ messages in thread

end of thread, other threads:[~2020-03-29 12:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-28  1:01 I could use some ideas for a strategy to get these kind of labels in a METAPOST picture Gerben Wierda
2020-03-28 17:58 ` Gerben Wierda
2020-03-28 18:04   ` Wolfgang Schuster
2020-03-29  8:47     ` Gerben Wierda
2020-03-29 10:44       ` Gerben Wierda
2020-03-29 12:00       ` Wolfgang Schuster

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).