Re: View kanji stroke order from within Vip

2019-08-03 Thread Wojciech Gac
Thanks for pointing this out.

Cheers,
Wojtek

sob., 3 sie 2019 o 11:26 Alexander Burger  napisał(a):

> On Fri, Aug 02, 2019 at 06:18:57PM +0200, Wojciech Gac wrote:
> > I've cooked up a tiny code snippet which, together with SVG images from
> the
>
> BTW,
>
>(de *F8 ()
>  (let ...
>
> is not really correct.
>
> The *Fn key definitions expect a 'prg' body, not a 'fun' function. So the
> () is
> NIL as the first expression in the body, and has no effect.
>
> Better would be
>
>(de *F8
>   (let ...
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: View kanji stroke order from within Vip

2019-08-03 Thread Alexander Burger
On Fri, Aug 02, 2019 at 06:18:57PM +0200, Wojciech Gac wrote:
> I've cooked up a tiny code snippet which, together with SVG images from the

BTW,

   (de *F8 ()
 (let ...

is not really correct.

The *Fn key definitions expect a 'prg' body, not a 'fun' function. So the () is
NIL as the first expression in the body, and has no effect.

Better would be

   (de *F8
  (let ...

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: View kanji stroke order from within Vip

2019-08-03 Thread Wojciech Gac
OK, what I thought would be the most difficult part, namely stroke
numbering, turns out to actually be pretty easy. Turns out, the original
SVGs have a "StrokeNumbers" section, in which the numbers are listed as
items of the form:

1

The two numbers at the end are just X and Y coordinates, so this could be
used to "postprocess" the image section of the XPM, placing the numbers by
hand (i.e. by code) in appropriate locations. An example result would be
something like this:

"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"  1 .  ..   ",
".. ..   ",
"  ..   ..   ",
"   ..   ",
"   ..   ",
"   ..   ",
"   ..   ",
"   ..   ",
"   ..   ",
"   ..   ",
"   ..   ",
"   ..   ",
"   ..   ",
"   ..   ",
"   ..   ",
"   ..   ",
" .. ",
"   .... ",
"2  ..   ",
"  ..   ..   ",
"   ..   ",
"   ..   ",
"   ..   ",
"   ..   ",
"   ..   ",
"   .",
"   .",
"   .",
"   .",
"   .",
"   .",
"   .",
"   .",
"   .",
"   .",
"   .",
"  3 ...    .",
".  .",
"   .",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""

Cheers,
Wojtek

sob., 3 sie 2019 o 10:49 Wojciech Gac  napisał(a):

> Using ImageMagick, it's easy to convert SVG to XPM. The example invocation
> would be:
> convert -monochrome -size 128x128 .svg .xpm
> It's very fast, so it could be done in a JIT fashion, perhaps caching the
> output images in some other directory to avoid redundant work.
> I'm experimenting with making the image part of an XPM readable enough to
> be useful.
>
> Cheers,
> Wojtek
>
> sob., 3 sie 2019 o 07:49 Alexander Burger 
> napisał(a):
>
>> Hi Wojtek,
>>
>> > I've cooked up a tiny code snippet which, together with SVG images from
>> the
>> > KanjiVG project, allows the user to view the stroke 

Re: View kanji stroke order from within Vip

2019-08-03 Thread Wojciech Gac
Using ImageMagick, it's easy to convert SVG to XPM. The example invocation
would be:
convert -monochrome -size 128x128 .svg .xpm
It's very fast, so it could be done in a JIT fashion, perhaps caching the
output images in some other directory to avoid redundant work.
I'm experimenting with making the image part of an XPM readable enough to
be useful.

Cheers,
Wojtek

sob., 3 sie 2019 o 07:49 Alexander Burger  napisał(a):

> Hi Wojtek,
>
> > I've cooked up a tiny code snippet which, together with SVG images from
> the
> > KanjiVG project, allows the user to view the stroke order of a kanji
> > character at cursor.
>
> Nice!
>
> I have not tried, but why did you write 'decimalToBase'? FYI, if it is
> just to
> get hexadecimal strings, you could use the 'hex' function in PicoLisp.
>
>
> > It would be cool to be able to automatically
> > convert the SVGs to ASCII art and perhaps display them natively within
> Vip.
>
> Indeed. One way would be to render the SVGs to some pixmap image, and
> convert
> the resulting bytes into a Vip buffer.
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: View kanji stroke order from within Vip

2019-08-02 Thread Alexander Burger
Hi Wojtek,

> I've cooked up a tiny code snippet which, together with SVG images from the
> KanjiVG project, allows the user to view the stroke order of a kanji
> character at cursor.

Nice!

I have not tried, but why did you write 'decimalToBase'? FYI, if it is just to
get hexadecimal strings, you could use the 'hex' function in PicoLisp.


> It would be cool to be able to automatically
> convert the SVGs to ASCII art and perhaps display them natively within Vip.

Indeed. One way would be to render the SVGs to some pixmap image, and convert
the resulting bytes into a Vip buffer.

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe