ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* ansi codes
@ 2008-09-30 10:23 Alan Stone
  2008-09-30 11:37 ` Taco Hoekwater
  0 siblings, 1 reply; 10+ messages in thread
From: Alan Stone @ 2008-09-30 10:23 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

How do you typeset font characters by their ansi code number, ex. Alt+33
(21h) ?

-- 
Best,
Alan

Ubuntu 8.04 Hardy Heron (Desktop)
  * ConTeXt  ver: 2008.09.16 19:49 MKIV  fmt: 2008.9.20  int:
english/english  (ConTeXt minimals installation)
  * texexec --lua foo

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

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

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

* Re: ansi codes
  2008-09-30 10:23 ansi codes Alan Stone
@ 2008-09-30 11:37 ` Taco Hoekwater
  2008-09-30 14:01   ` Alan Stone
  0 siblings, 1 reply; 10+ messages in thread
From: Taco Hoekwater @ 2008-09-30 11:37 UTC (permalink / raw)
  To: ntg-context

On Tue, 30 Sep 2008 12:23:56 +0200
"Alan Stone" <software.list.1es9s@gmail.com> wrote:

> How do you typeset font characters by their ansi code number, ex. Alt+33
> (21h) ?

\char "21 % hex
\char 33  % decimal


Best wishes,
Taco
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: ansi codes
  2008-09-30 11:37 ` Taco Hoekwater
@ 2008-09-30 14:01   ` Alan Stone
  2008-09-30 14:16     ` Taco Hoekwater
  0 siblings, 1 reply; 10+ messages in thread
From: Alan Stone @ 2008-09-30 14:01 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

On Tue, Sep 30, 2008 at 1:37 PM, Taco Hoekwater <taco@elvenkind.com> wrote:

> On Tue, 30 Sep 2008 12:23:56 +0200
> "Alan Stone" <software.list.1es9s@gmail.com> wrote:
>
> > How do you typeset font characters by their ansi code number, ex. Alt+33
> > (21h) ?
>
> \char "21 % hex
> \char 33  % decimal
>

Thanks Taco.

It didn't work as expected. It outputs exclamation points.

- font: combinumerals ( http://www.fontsite.com/bonusfonts/cnfree_tt.zip )
- font encoding type: symbol
- supported unicode ranges: general punctuation

What's missing here ?

\starttypescript [sans] [combinumerals]
     \definefontsynonym [CombinumeralsRegular]    [name:combinumerals]
                    [features=default]
     \definefontsynonym [CombinumeralsBold]
[name:combinumeralsbold]                [features=default]
\stoptypescript

\starttypescript [sans] [combinumerals]
     \setups [font:fallback:sans]
     \definefontsynonym [sans]                    [CombinumeralsRegular]
     \definefontsynonym [sansBold]            [CombinumeralsBold]
\stoptypescript

\starttypescript [combinumerals]
     \definetypeface [combinumerals] [ss] [sans] [combinumerals] [default]
\stoptypescript

\usetypescript[combinumerals]

\starttext
%\showcharacters
%\page
\char 33
\blank
\char "21
\stoptext

-- 
Best,
Alan

Ubuntu 8.04 Hardy Heron (Desktop)
  * ConTeXt  ver: 2008.09.16 19:49 MKIV  fmt: 2008.9.20  int:
english/english  (ConTeXt minimals installation)
  * texexec --lua foo

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

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

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

* Re: ansi codes
  2008-09-30 14:01   ` Alan Stone
@ 2008-09-30 14:16     ` Taco Hoekwater
  2008-10-01 12:57       ` Alan Stone
  0 siblings, 1 reply; 10+ messages in thread
From: Taco Hoekwater @ 2008-09-30 14:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users



Alan Stone wrote:
> On Tue, Sep 30, 2008 at 1:37 PM, Taco Hoekwater <taco@elvenkind.com 
> <mailto:taco@elvenkind.com>> wrote:
> 
>     On Tue, 30 Sep 2008 12:23:56 +0200
>     "Alan Stone" <software.list.1es9s@gmail.com
>     <mailto:software.list.1es9s@gmail.com>> wrote:
> 
>      > How do you typeset font characters by their ansi code number, ex.
>     Alt+33
>      > (21h) ?
> 
>     \char "21 % hex
>     \char 33  % decimal
> 
> 
> Thanks Taco.
> 
> It didn't work as expected. It outputs exclamation points.

OK, fetched the font.

> \starttypescript [sans] [combinumerals]
>      \setups [font:fallback:sans]
>      \definefontsynonym [sans]                    [CombinumeralsRegular]
>      \definefontsynonym [sansBold]            [CombinumeralsBold]
> \stoptypescript

Two changes are needed here

[Sans]       instead of   [sans]
[SansBold]   instead of   [sansBold]

> \starttext
> %\showcharacters
> %\page

Have to add a font switching command here:

   \switchtobodyfont[combinumerals,ss]

Best wishes,
Taco
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: ansi codes
  2008-09-30 14:16     ` Taco Hoekwater
@ 2008-10-01 12:57       ` Alan Stone
  2008-10-01 13:05         ` Taco Hoekwater
  2008-10-01 18:30         ` Mojca Miklavec
  0 siblings, 2 replies; 10+ messages in thread
From: Alan Stone @ 2008-10-01 12:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Wonderful !

Is there a (preferably free) Linux or Windows font tool out there which
allows to print a font's characters and corresponding character codes ?


On Tue, Sep 30, 2008 at 4:16 PM, Taco Hoekwater <taco@elvenkind.com> wrote:

>
>
> Alan Stone wrote:
> > On Tue, Sep 30, 2008 at 1:37 PM, Taco Hoekwater <taco@elvenkind.com
> > <mailto:taco@elvenkind.com>> wrote:
> >
> >     On Tue, 30 Sep 2008 12:23:56 +0200
> >     "Alan Stone" <software.list.1es9s@gmail.com
> >     <mailto:software.list.1es9s@gmail.com>> wrote:
> >
> >      > How do you typeset font characters by their ansi code number, ex.
> >     Alt+33
> >      > (21h) ?
> >
> >     \char "21 % hex
> >     \char 33  % decimal
> >
> >
> > Thanks Taco.
> >
> > It didn't work as expected. It outputs exclamation points.
>
> OK, fetched the font.
>
> > \starttypescript [sans] [combinumerals]
> >      \setups [font:fallback:sans]
> >      \definefontsynonym [sans]                    [CombinumeralsRegular]
> >      \definefontsynonym [sansBold]            [CombinumeralsBold]
> > \stoptypescript
>
> Two changes are needed here
>
> [Sans]       instead of   [sans]
> [SansBold]   instead of   [sansBold]
>
> > \starttext
> > %\showcharacters
> > %\page
>
> Have to add a font switching command here:
>
>   \switchtobodyfont[combinumerals,ss]
>
> Best wishes,
> Taco
>

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

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

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

* Re: ansi codes
  2008-10-01 12:57       ` Alan Stone
@ 2008-10-01 13:05         ` Taco Hoekwater
  2008-10-01 18:30         ` Mojca Miklavec
  1 sibling, 0 replies; 10+ messages in thread
From: Taco Hoekwater @ 2008-10-01 13:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users



Alan Stone wrote:
> Wonderful !
> 
> Is there a (preferably free) Linux or Windows font tool out there which 
> allows to print a font's characters and corresponding character codes ?

I use fontforge: http://fontforge.sourceforge.net/

Best wishes,
Taco
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: ansi codes
  2008-10-01 12:57       ` Alan Stone
  2008-10-01 13:05         ` Taco Hoekwater
@ 2008-10-01 18:30         ` Mojca Miklavec
  2008-10-01 20:00           ` Hans Hagen
  1 sibling, 1 reply; 10+ messages in thread
From: Mojca Miklavec @ 2008-10-01 18:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Wed, Oct 1, 2008 at 2:57 PM, Alan Stone wrote:
>
> Is there a (preferably free) Linux or Windows font tool out there which
> allows to print a font's characters and corresponding character codes ?

Geeks do it with LuaTeX :)

I'm not sure if this still works since I have no luatex here, but in
theory you can play with something like this:

% do whatever you want with it
\def\mychar#1#2{#1: #2\crlf}

\starttext
\ctxlua{
	fontname = 'texgyrepagella-regular.otf'
	tfmdata = fonts.tfm.read_and_define("file:" .. fontname, 655360)

	w = tfmdata.characters
	for i=0,100000 do
		if w[i] then
			tex.sprint("\\strut\\mychar{" .. i, "}{\\type{", w[i].name, "}}")
		end
	end
}
\stoptext

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


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

* Re: ansi codes
  2008-10-01 18:30         ` Mojca Miklavec
@ 2008-10-01 20:00           ` Hans Hagen
  2008-10-03 20:15             ` Alan Stone
  2008-11-14 15:25             ` Thomas A. Schmitz
  0 siblings, 2 replies; 10+ messages in thread
From: Hans Hagen @ 2008-10-01 20:00 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Mojca Miklavec wrote:
> On Wed, Oct 1, 2008 at 2:57 PM, Alan Stone wrote:
>> Is there a (preferably free) Linux or Windows font tool out there which
>> allows to print a font's characters and corresponding character codes ?
> 
> Geeks do it with LuaTeX :)
> 
> I'm not sure if this still works since I have no luatex here, but in
> theory you can play with something like this:
> 
> % do whatever you want with it
> \def\mychar#1#2{#1: #2\crlf}
> 
> \starttext
> \ctxlua{
> 	fontname = 'texgyrepagella-regular.otf'
> 	tfmdata = fonts.tfm.read_and_define("file:" .. fontname, 655360)
> 
> 	w = tfmdata.characters
> 	for i=0,100000 do
> 		if w[i] then
> 			tex.sprint("\\strut\\mychar{" .. i, "}{\\type{", w[i].name, "}}")
> 		end
> 	end
> }
> \stoptext

lesser geeks loom in s-fnt-10.tex -)

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: ansi codes
  2008-10-01 20:00           ` Hans Hagen
@ 2008-10-03 20:15             ` Alan Stone
  2008-11-14 15:25             ` Thomas A. Schmitz
  1 sibling, 0 replies; 10+ messages in thread
From: Alan Stone @ 2008-10-03 20:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

On Wed, Oct 1, 2008 at 10:00 PM, Hans Hagen <pragma@wxs.nl> wrote:

> Mojca Miklavec wrote:
> > On Wed, Oct 1, 2008 at 2:57 PM, Alan Stone wrote:
> >> Is there a (preferably free) Linux or Windows font tool out there which
> >> allows to print a font's characters and corresponding character codes ?
> >
> > Geeks do it with LuaTeX :)
> >
> > I'm not sure if this still works since I have no luatex here, but in
> > theory you can play with something like this:
> >
> > % do whatever you want with it
> > \def\mychar#1#2{#1: #2\crlf}
> >
> > \starttext
> > \ctxlua{
> >       fontname = 'texgyrepagella-regular.otf'
> >       tfmdata = fonts.tfm.read_and_define("file:" .. fontname, 655360)
> >
> >       w = tfmdata.characters
> >       for i=0,100000 do
> >               if w[i] then
> >                       tex.sprint("\\strut\\mychar{" .. i, "}{\\type{",
> w[i].name, "}}")
> >               end
> >       end
> > }
> > \stoptext
>
> lesser geeks loom in s-fnt-10.tex -)
>
> Hans
>
>

Is something missing to make it work ? See attachements.

Tried with WXP & LNX.

-- 
Best,
Alan

* texexec --lua foo
* ConTeXt  ver: 2008.10.01 19:13 MKIV  fmt: 2008.10.3  int: english/english
* Ubuntu 8.04 Hardy Heron (Desktop)

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

[-- Attachment #2: s-fnt-10.tex --]
[-- Type: application/x-tex, Size: 1191 bytes --]

[-- Attachment #3: s-fnt-10.log --]
[-- Type: application/octet-stream, Size: 2414 bytes --]

(s-fnt-10.tex

ConTeXt  ver: 2008.10.01 00:07 MKIV  fmt: 2008.10.2  int: english/english

language       : language en is active
system         : cont-new loaded
(C:/context/tex/texmf-context/tex/context/base/cont-new.tex
systems         : beware: some patches loaded from cont-new.tex
(C:/context/tex/texmf-context/tex/context/base/cont-new.mkiv
lua            : used config path - C:/context/tex/texmf/web2c/texmf.cnf
lua            : used cache path - C:/context/tex/texmf-cache/luatex-cache/context/2fea56f92e5267d7cc9662e4d5f52e1e
) (C:/context/tex/texmf-context/tex/context/base/cont-mtx.tex))
system         : cont-old loaded
(C:/context/tex/texmf-context/tex/context/base/cont-old.tex
loading        : Context Old Macros
)
system         : cont-fil loaded
(C:/context/tex/texmf-context/tex/context/base/cont-fil.tex
loading        : Context File Synonyms
)
system         : cont-sys loaded
(C:/context/tex/texmf-context/tex/context/user/cont-sys.tex (C:/context/tex/texmf-context/tex/context/base/type-tmf.tex) (C:/context/tex/texmf-context/tex/context/base/type-siz.tex) (C:/context/tex/texmf-context/tex/context/base/type-otf.tex))
bodyfont       : 12pt rm is loaded
specials       : tex loaded
system         : s-fnt-10.top loaded
(s-fnt-10.top
specials       : loading definition file tpd
(C:/context/tex/texmf-context/tex/context/base/spec-tpd.tex
specials       : loading definition file fdf
(C:/context/tex/texmf-context/tex/context/base/spec-fdf.tex (C:/context/tex/texmf-context/tex/context/base/spec-fdf.mkiv))
specials       : fdf loaded
(C:/context/tex/texmf-context/tex/context/base/spec-tpd.mkiv))
specials       : fdf loaded
) (s-fnt-10.tuo) (s-fnt-10.tuo)
systems        : begin file s-fnt-10 at line 43
! LuaTeX error <main ctx instance>:1: attempt to call field 'show_all' (a nil value)
stack traceback:
	<main ctx instance>:1: in main chunk.
\ShowCompleteFont ... \ctxlua { fonts.show_all() }
                                                   \stopcolumns \page \egroup 
l.48 \ShowCompleteFont{name:arial}{10pt}{2}
                                           
? 
! Emergency stop.
\ShowCompleteFont ... \ctxlua { fonts.show_all() }
                                                   \stopcolumns \page \egroup 
l.48 \ShowCompleteFont{name:arial}{10pt}{2}
                                           
End of file on the terminal!

!  ==> Fatal error occurred, no output PDF file produced!

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

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

* Re: ansi codes
  2008-10-01 20:00           ` Hans Hagen
  2008-10-03 20:15             ` Alan Stone
@ 2008-11-14 15:25             ` Thomas A. Schmitz
  1 sibling, 0 replies; 10+ messages in thread
From: Thomas A. Schmitz @ 2008-11-14 15:25 UTC (permalink / raw)
  To: mailing list for ConTeXt users


On Oct 1, 2008, at 10:00 PM, Hans Hagen wrote:

> lesser geeks loom in s-fnt-10.tex -)
>
> Hans

Hi Hans,

the file s-fnt-10.lua needs to be added to the distribution.

Best

Thomas


function fonts.otf.show_all()

    local tfmdata = fonts.tfm.id[font.current()]

    if tfmdata and tfmdata.shared then
        local otfdata = tfmdata.shared.otfdata
        if otfdata and otfdata.luatex then
            local unicodes = otfdata.luatex.unicodes
            tex.sprint(tex.ctxcatcodes,string.format("\\starttabulate[| 
l|r|c|]"))
            for i, name in ipairs(table.sortedkeys(unicodes)) do
                local unicode = unicodes[name]
                if unicode >= 0 then
                    tex.sprint(tex.ctxcatcodes,string.format("\\NC %s \ 
\NC %s \\NC \\char%s \\NC\\NR",name,unicode,unicode))
                end
            end
            tex.sprint(tex.ctxcatcodes,string.format("\\stoptabulate"))
        end
    end

end

function fonts.show_all()

    local tfmdata = fonts.tfm.id[font.current()]

    if tfmdata and tfmdata.shared then
        local chars = tfmdata.characters
        tex.sprint(tex.ctxcatcodes,string.format("\\starttabulate[|l|r| 
r|c|]"))
        for k, v in ipairs(table.sortedkeys(chars)) do
            tex.sprint(tex.ctxcatcodes,string.format("\\NC %s\\NC %s\ 
\NC \\char%s\\NC %s\\NC\\NR",chars[v].name or  
"unknown",v,v,chars[v].index))
        end
        tex.sprint(tex.ctxcatcodes,string.format("\\stoptabulate"))
    end

end

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


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

end of thread, other threads:[~2008-11-14 15:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-30 10:23 ansi codes Alan Stone
2008-09-30 11:37 ` Taco Hoekwater
2008-09-30 14:01   ` Alan Stone
2008-09-30 14:16     ` Taco Hoekwater
2008-10-01 12:57       ` Alan Stone
2008-10-01 13:05         ` Taco Hoekwater
2008-10-01 18:30         ` Mojca Miklavec
2008-10-01 20:00           ` Hans Hagen
2008-10-03 20:15             ` Alan Stone
2008-11-14 15:25             ` Thomas A. Schmitz

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