ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Dotted characters
@ 2016-08-16  7:17 Procházka Lukáš Ing.
  2016-08-16  7:43 ` Taco Hoekwater
  0 siblings, 1 reply; 7+ messages in thread
From: Procházka Lukáš Ing. @ 2016-08-16  7:17 UTC (permalink / raw)
  To: ConTeXt

Hello,

I'm preparing a child copybook.
I'd like to write a uppercased letter "as is" followed by its shape drawn with dots - something like

    /\       .
   /  \     . .
  /____\   .....
/      \ .     .

I guess that some MP "trick(s)" might be used;
also, a "simple" font should be used to be drawn dotted, which uses "single drawings" to draw each line of the character.

Could anybody help with such (MP) code?

Best regards,

Lukas


-- 
Ing. Lukáš Procházka | mailto:LPr@pontex.cz
Pontex s. r. o.      | mailto:pontex@pontex.cz | http://www.pontex.cz | IDDS:nrpt3sn
Bezová 1658
147 14 Praha 4

Tel: +420 241 096 751 (+420 720 951 172)
Fax: +420 244 461 038

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Dotted characters
  2016-08-16  7:17 Dotted characters Procházka Lukáš Ing.
@ 2016-08-16  7:43 ` Taco Hoekwater
  2016-08-16  7:54   ` Hans Hagen
                     ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Taco Hoekwater @ 2016-08-16  7:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Hi Lukáš,

> On 16 Aug 2016, at 09:17, Procházka Lukáš Ing. <LPr@pontex.cz> wrote:
> 
> Hello,
> 
> I'm preparing a child copybook.
> I'd like to write a uppercased letter "as is" followed by its shape drawn with dots - something like
> 
>   /\       .
>  /  \     . .
> /____\   .....
> /      \ .     .
> 
> I guess that some MP "trick(s)" might be used;
> also, a "simple" font should be used to be drawn dotted, which uses "single drawings" to draw each line of the character.

Most anything can be programmed, but in this case the task is very difficult. 

Modern fonts always use filled paths instead of stroke lines, so an “A” consists of two paths: the outer shape and the middle triange are separate:
    _
   / \
  /   \          /\
 /  _  \        /__\
/_/   \_\

there is no easy way to convert that into a dotted line that matches the ‘black parts’ of the glyph shape. Perhaps you could use two regular fonts: one sans-serif and one with dotted lines? There are some free fonts with dotted lines that can be found on the web, e.g. here: http://www.fontspace.com/category/dotted-line

Another option would be draw the ‘normal’ uppercase letter directly as a metapost path. In that case it would be rather simple to create a generic dotted path from that using ‘setdash’. However, without manual work, it will not look as good as pre-drawn font, because for a ‘nice’ dotted path you need to make sure that the dots in the crossbar of an ‘A’ line up nicely with the dots in the diagonal outer strokes, which is quite hard to do.

Best wishes,
Taco





Taco Hoekwater
Elvenkind BV





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

[-- Attachment #2: Type: text/plain, Size: 485 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Dotted characters
  2016-08-16  7:43 ` Taco Hoekwater
@ 2016-08-16  7:54   ` Hans Hagen
  2016-08-16  8:25     ` Procházka Lukáš Ing.
  2016-08-16  8:24   ` Procházka Lukáš Ing.
  2016-08-20 12:03   ` Lukáš Procházka
  2 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2016-08-16  7:54 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 2375 bytes --]

On 8/16/2016 9:43 AM, Taco Hoekwater wrote:
> Hi Lukáš,
>
>> On 16 Aug 2016, at 09:17, Procházka Lukáš Ing. <LPr@pontex.cz
>> <mailto:LPr@pontex.cz>> wrote:
>>
>> Hello,
>>
>> I'm preparing a child copybook.
>> I'd like to write a uppercased letter "as is" followed by its shape
>> drawn with dots - something like
>>
>>   /\       .
>>  /  \     . .
>> /____\   .....
>> /      \ .     .
>>
>> I guess that some MP "trick(s)" might be used;
>> also, a "simple" font should be used to be drawn dotted, which uses
>> "single drawings" to draw each line of the character.
>
> Most anything can be programmed, but in this case the task is very
> difficult.
>
> Modern fonts always use filled paths instead of stroke lines, so an “A”
> consists of two paths: the outer shape and the middle triange are separate:
>     _
>    / \
>   /   \          /\
>  /  _  \        /__\
> /_/   \_\
>
> there is no easy way to convert that into a dotted line that matches the
> ‘black parts’ of the glyph shape. Perhaps you could use two regular
> fonts: one sans-serif and one with dotted lines? There are some free
> fonts with dotted lines that can be found on the web, e.g.
> here: http://www.fontspace.com/category/dotted-line
>
> Another option would be draw the ‘normal’ uppercase letter directly as a
> metapost path. In that case it would be rather simple to create a
> generic dotted path from that using ‘setdash’. However, without manual
> work, it will not look as good as pre-drawn font, because for a ‘nice’
> dotted path you need to make sure that the dots in the crossbar of an
> ‘A’ line up nicely with the dots in the diagonal outer strokes, which is
> quite hard to do.

the best one can expect without too much work is

\startMPpage
     draw outlinetext.f
         ("A")
         () ;
     currentpicture := currentpicture shifted (-bbwidth currentpicture,0) ;
     draw outlinetext.d
         ("A")
         (withpen pencircle scaled 1/10
          dashed withdots scaled 1/20) ;
\stopMPpage

see attached

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------

[-- Attachment #2: temp.pdf --]
[-- Type: application/applefile, Size: 3782 bytes --]

[-- Attachment #3: temp.tex --]
[-- Type: application/x-tex, Size: 266 bytes --]

[-- Attachment #4: Type: text/plain, Size: 485 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Dotted characters
  2016-08-16  7:43 ` Taco Hoekwater
  2016-08-16  7:54   ` Hans Hagen
@ 2016-08-16  8:24   ` Procházka Lukáš Ing.
  2016-08-20 12:03   ` Lukáš Procházka
  2 siblings, 0 replies; 7+ messages in thread
From: Procházka Lukáš Ing. @ 2016-08-16  8:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello Taco,

On Tue, 16 Aug 2016 09:43:12 +0200, Taco Hoekwater <taco@elvenkind.com> wrote:

> Hi Lukáš,
>
>
> Most anything can be programmed, but in this case the task is very difficult.
>
> Modern fonts always use filled paths instead of stroke lines, so an “A” consists of two paths: the outer shape and the middle triange are separate:
>     _
>    / \
>   /   \          /\
>  /  _  \        /__\
> /_/   \_\
>

yes, I was aware of that, that's why I mentioned a "single-drawings-character".

> there is no easy way to convert that into a dotted line that matches the ‘black parts’ of the glyph shape. Perhaps you could use two regular fonts: one sans-serif and one with dotted lines? There are some free fonts with dotted lines that can be found on the web, e.g. here: http://www.fontspace.com/category/dotted-line

Great, it seems that "Trace Font for Kids"
	http://www.fontspace.com/p-j-cassel/trace-font-for-kids
would be exactly what I need.

>
> Another option would be draw the ‘normal’ uppercase letter directly as a metapost path.

Yes, I thought so.

> In that case it would be rather simple to create a generic dotted path from that using ‘setdash’. However, without manual work, it will not look as good as pre-drawn font, because for a ‘nice’ dotted path you need to make sure that the dots in the crossbar of an ‘A’ line up nicely with the dots in the diagonal outer strokes, which is quite hard to do.

OK, thanks for you response - I'll try Trace Font for Kids first.

Best regards,

Lukas

>
> Best wishes,
> Taco
>
>
>
>
>
> Taco Hoekwater
> Elvenkind BV
>
>
>
>
>


-- 
Ing. Lukáš Procházka | mailto:LPr@pontex.cz
Pontex s. r. o.      | mailto:pontex@pontex.cz | http://www.pontex.cz | IDDS:nrpt3sn
Bezová 1658
147 14 Praha 4

Tel: +420 241 096 751 (+420 720 951 172)
Fax: +420 244 461 038

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Dotted characters
  2016-08-16  7:54   ` Hans Hagen
@ 2016-08-16  8:25     ` Procházka Lukáš Ing.
  0 siblings, 0 replies; 7+ messages in thread
From: Procházka Lukáš Ing. @ 2016-08-16  8:25 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello Hans,

On Tue, 16 Aug 2016 09:54:26 +0200, Hans Hagen <pragma@wxs.nl> wrote:

>
> the best one can expect without too much work is
>
> \startMPpage
>      draw outlinetext.f
>          ("A")
>          () ;
>      currentpicture := currentpicture shifted (-bbwidth currentpicture,0) ;
>      draw outlinetext.d
>          ("A")
>          (withpen pencircle scaled 1/10
>           dashed withdots scaled 1/20) ;
> \stopMPpage
>
> see attached

thanks for the code; I'll try Taco's way first, maybe later the MP code.

Best regards,

Lukas


-- 
Ing. Lukáš Procházka | mailto:LPr@pontex.cz
Pontex s. r. o.      | mailto:pontex@pontex.cz | http://www.pontex.cz | IDDS:nrpt3sn
Bezová 1658
147 14 Praha 4

Tel: +420 241 096 751 (+420 720 951 172)
Fax: +420 244 461 038

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Dotted characters
  2016-08-16  7:43 ` Taco Hoekwater
  2016-08-16  7:54   ` Hans Hagen
  2016-08-16  8:24   ` Procházka Lukáš Ing.
@ 2016-08-20 12:03   ` Lukáš Procházka
  2016-08-20 12:35     ` Wolfgang Schuster
  2 siblings, 1 reply; 7+ messages in thread
From: Lukáš Procházka @ 2016-08-20 12:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 1667 bytes --]

Hello again,

the dotted font works perfectly.

I'm using Lua to generate sheets from a database which contains word-picture-picture2 records (see attached single page sample; I had to convert the image to .jpg to reduce file size).

One more question - is there a ConTeXt/Lua function which would assign a non-diacritical-character to that with diacritics, like:

Á => A
Š => S
Ý => Y etc.?

I'm asking as the "Trace Font for Kids" doesn't contain characters with diacritics...

Simple Lua table would do the job, like

----
remove_dia_czech =
{ ["é"] = "e",
   ["š"] = "s",
   ...
}
----

But string pattern in Lua with cp1250/UTF-8 might not be so easy as Lua pattern "." matches single char (or - better - one byte - I guess), so with UTF-8, chars with diacritics need more bytes; so the code

----
str = ("Řetězec with diacritics"):gsub(".", remove_dia_czech)
----

probably won't work.

And Ctx Lua could have a mechanism already...

Best regards,

Lukas

On Tue, 16 Aug 2016 09:43:12 +0200, Taco Hoekwater <taco@elvenkind.com> wrote:

> there is no easy way to convert that into a dotted line that matches the ‘black parts’ of the glyph shape. Perhaps you could use two regular fonts: one sans-serif and one with dotted lines? There are some free fonts with dotted lines that can be found on the web, e.g. here: http://www.fontspace.com/category/dotted-line
>
> Best wishes,
> Taco


-- 
Ing. Lukáš Procházka | mailto:LPr@pontex.cz
Pontex s. r. o.      | mailto:pontex@pontex.cz | http://www.pontex.cz | IDDS:nrpt3sn
Bezová 1658
147 14 Praha 4

Tel: +420 241 096 751 (+420 720 951 172)
Fax: +420 244 461 038

[-- Attachment #2: Pismenka-1~.jpg --]
[-- Type: image/jpeg, Size: 47349 bytes --]

[-- Attachment #3: Type: text/plain, Size: 485 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Dotted characters
  2016-08-20 12:03   ` Lukáš Procházka
@ 2016-08-20 12:35     ` Wolfgang Schuster
  0 siblings, 0 replies; 7+ messages in thread
From: Wolfgang Schuster @ 2016-08-20 12:35 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

> Lukáš Procházka <mailto:LPr@pontex.cz>
> 20. August 2016 um 14:03
> Hello again,
>
> the dotted font works perfectly.
>
> I'm using Lua to generate sheets from a database which contains 
> word-picture-picture2 records (see attached single page sample; I had 
> to convert the image to .jpg to reduce file size).
>
> One more question - is there a ConTeXt/Lua function which would assign 
> a non-diacritical-character to that with diacritics, like:
>
> Á => A
> Š => S
> Ý => Y etc.?
>
> I'm asking as the "Trace Font for Kids" doesn't contain characters 
> with diacritics...
>
> Simple Lua table would do the job, like
>
> ----
> remove_dia_czech =
> { ["é"] = "e",
>   ["š"] = "s",
>   ...
> }
> ----
>
> But string pattern in Lua with cp1250/UTF-8 might not be so easy as 
> Lua pattern "." matches single char (or - better - one byte - I 
> guess), so with UTF-8, chars with diacritics need more bytes; so the code
>
> ----
> str = ("Řetězec with diacritics"):gsub(".", remove_dia_czech)
> ----
>
> probably won't work.
>
> And Ctx Lua could have a mechanism already...
You can use the “characters.shaped” function which is described in 
cld-mkiv.pdf at page 87 and 119.

\starttext
Řetězec = \cldcontext{characters.shaped("Řetězec")}
\stoptext

Wolfgang

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

[-- Attachment #2: Type: text/plain, Size: 485 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2016-08-20 12:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-16  7:17 Dotted characters Procházka Lukáš Ing.
2016-08-16  7:43 ` Taco Hoekwater
2016-08-16  7:54   ` Hans Hagen
2016-08-16  8:25     ` Procházka Lukáš Ing.
2016-08-16  8:24   ` Procházka Lukáš Ing.
2016-08-20 12:03   ` Lukáš Procházka
2016-08-20 12:35     ` 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).