ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* setups within typescripts: can it be done?
@ 2013-03-11 16:51 Idris Samawi Hamid ادريس   سماوي حامد
  2013-03-13  1:01 ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Idris Samawi Hamid ادريس   سماوي حامد @ 2013-03-11 16:51 UTC (permalink / raw)
  To: ntg-context

Dear gang,

Here is the situation: For an upcoming book project I may use a set of  
proprietary fonts whose license that does not allow modification even for  
personal, private use. Some characters I need are absent, but the  
components I need are there (macrons, dots, etc). So I can conceivably use  
\defineactivecharacter to map each needed unicode char to a \def made of  
glyph components in the font.

Now in a typescript we have different fonts: Each individual font needs  
its own setup in terms of \defineactivecharacter. So the final typeface  
will be able to associate each individual font with its associated setup.  
So here's my idea:

==============
\startsetups font1
\defineactivecharacter b blah1
\stopsetups


\startsetups font2
\defineactivecharacter b blah2
\stopsetups


\starttypescript [serif] [name]

\definefontsynonym  
[MyFont1][name:SuperFontRgular][features=myfeatures,fallbacks=myfallback,setups=font1]
\definefontsynonym  
[MyFont2][name:SuperFontItalic][features=myfeatures,fallbacks=myfallback,setups=font2]

\stoptypescript
===============

Is this doable? If not is there another way? If doable, is there a better  
way?

If this is totally undoable, then here is another approach: Is there a way  
in mkiv to make a definition that can translate the following:

==========
If font1 is active use def1
If font2 is active use def2
:
Else \relax
==========

If not, are there any other ideas?

Thanks in advance for any hints and guidance.

Best wishes
Idris
-- 
Professor Idris Samawi Hamid
Department of Philosophy
Colorado State University
Fort Collins, CO 80523
___________________________________________________________________________________
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] 4+ messages in thread

* Re: setups within typescripts: can it be done?
  2013-03-11 16:51 setups within typescripts: can it be done? Idris Samawi Hamid ادريس   سماوي حامد
@ 2013-03-13  1:01 ` Hans Hagen
  2013-03-13  1:37   ` Idris Samawi Hamid ادريس   سماوي حامد
  0 siblings, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2013-03-13  1:01 UTC (permalink / raw)
  To: mailing list for ConTeXt users
  Cc: Idris Samawi Hamid ادريس
	سماوي حامد

On 3/11/2013 5:51 PM, Idris Samawi Hamid ادريس   سماوي حامد wrote:
> Dear gang,
>
> Here is the situation: For an upcoming book project I may use a set of
> proprietary fonts whose license that does not allow modification even
> for personal, private use. Some characters I need are absent, but the

I'd choose another font.

> components I need are there (macrons, dots, etc). So I can conceivably
> use \defineactivecharacter to map each needed unicode char to a \def
> made of glyph components in the font.

there is a 'compose' feature that does some virtual magic ... it's also 
possible to specify things in a lfg file .. here is a copy from an 
upcoming manual:

Yet another demonstration of manipulation is the following. Not all 
fonts come
with all combined glyphs. Although we have an auto|-|compose feature in 
\CONTEXT\
it sometimes helps to be specific with respect to some combinations. This is
where the \type {compositions} goodie kicks in:

\starttyping
local compose = {
   [0x1E02] = {
     anchored = "top",
   },
   [0x1E04] = {
     anchored = "bottom",
   },
   [0x0042] = { -- B
     anchors = {
       top = {
         x = 300,
         y = 700,
       },
       bottom = {
         x = 300,
         y = -30,
       },
     },
   },
   [0x0307] = {
     anchors = {
       top = {
         x = -250,
         y = 550,
       },
     },
   },
   [0x0323] = {
     anchors = {
       bottom = {
         x = -250,
         y = -80,
       },
     },
   },
}

return {
   name = "lm-compose-test",
   version = "1.00",
   comment = "Goodies that demonstrate composition.",
   author = "Hans and Mojca",
   copyright = "ConTeXt development team",
   compositions = {
     ["lmroman12-regular"] = compose,
   }
}
\stoptyping

Of course this assumes some knowledge of the font metrics (in base 
points) and
\UNICODE\ slots, but it might be worth the trouble. After all, one only 
needs to
figure it out once. But keep in mind that it will always be a kludge.

A slightly different way to define such compositions is the following:

\starttyping
local defaultunits = 193 - 30

local compose = {
                  DY = defaultunits,
  -- [0x010C] = { DY = defaultunits }, -- Ccaron
  -- [0x02C7] = { DY = defaultunits }, -- textcaron
}

-- fractions relative to delta(X_height - x_height)

local defaultfraction = 0.85

local compose = {
   DY = defaultfraction, -- uppercase compensation
}

return {
   name = "lucida-one",
   version = "1.00",
   comment = "Goodies that complement lucida.",
   author = "Hans and Mojca",
   copyright = "ConTeXt development team",
   compositions = {
     ["lbr"]  = compose,
     ["lbi"]  = compose,
     ["lbd"]  = compose,
     ["lbdi"] = compose,
   }
}
\stoptyping

Of course no one really needs this because \OPENTYPE\ Lucida fonts
have replaced the \TYPEONE\ versions.



-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: setups within typescripts: can it be done?
  2013-03-13  1:01 ` Hans Hagen
@ 2013-03-13  1:37   ` Idris Samawi Hamid ادريس   سماوي حامد
  2013-03-13  9:09     ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Idris Samawi Hamid ادريس   سماوي حامد @ 2013-03-13  1:37 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Hans Hagen

Hi Hans,

Thanks for the reply:

On Tue, 12 Mar 2013 19:01:30 -0600, Hans Hagen <pragma@wxs.nl> wrote:

> On 3/11/2013 5:51 PM, Idris Samawi Hamid ادريس   سماوي حامد wrote:
>> Dear gang,
>>
>> Here is the situation: For an upcoming book project I may use a set of
>> proprietary fonts whose license that does not allow modification even
>> for personal, private use. Some characters I need are absent, but the
>
> I'd choose another font.

LOL.

If you're referring to the private-use restriction: Adobe allows  
private/personal modifications for most fonts, so I could get away with  
making small fallbacks, etc. In the end, I may very well go with a company  
like Adobe for just this reason.

(On the other hand, all of their optical sized book fonts are made by the  
same designer and have the same feel ... I'd like to try something  
different if I can find it).

If you're referring to finding a font that has all the requisite  
characters: Hardly any HQ commercial text font for books has the requisite  
characters (mostly but not all in the Latin Extended Additional block).  
TeX-Gyre has the chars (I lobbied for them some years ago) but for the  
current project T-G is not really an option.

>> components I need are there (macrons, dots, etc). So I can conceivably
>> use \defineactivecharacter to map each needed unicode char to a \def
>> made of glyph components in the font.
>
> there is a 'compose' feature that does some virtual magic ...

Yes, I tried that a long time ago; will try again, though more precision  
will be needed, especially for italic etc..

> it's also possible to specify things in a lfg file .. here is a copy  
> from an upcoming manual:

<snip>

Yaay, I look forward to reading that! I was thinking that the goodies file  
would be the ideal place to put the specs.

> Of course this assumes some knowledge of the font metrics (in base  
> points) and
> \UNICODE\ slots, but it might be worth the trouble. After all, one only  
> needs to
> figure it out once. But keep in mind that it will always be a kludge.
>
> A slightly different way to define such compositions is the following:

<snip>

Ok, I'll study that as well

> Of course no one really needs this because \OPENTYPE\ Lucida fonts
> have replaced the \TYPEONE\ versions.

Indeed. OTOH, I just found this wonderful (+very-expensive) Dutch typeface  
that is still(!) only available in Type1/ttf format.

Thanks again and

Best wishes
Idris
-- 
Professor Idris Samawi Hamid
Department of Philosophy
Colorado State University
Fort Collins, CO 80523
___________________________________________________________________________________
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] 4+ messages in thread

* Re: setups within typescripts: can it be done?
  2013-03-13  1:37   ` Idris Samawi Hamid ادريس   سماوي حامد
@ 2013-03-13  9:09     ` Hans Hagen
  0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2013-03-13  9:09 UTC (permalink / raw)
  To: Idris Samawi Hamid ادريس
	سماوي حامد
  Cc: mailing list for ConTeXt users

On 3/13/2013 2:37 AM, Idris Samawi Hamid ادريس   سماوي حامد wrote:

> Indeed. OTOH, I just found this wonderful (+very-expensive) Dutch
> typeface that is still(!) only available in Type1/ttf format.

I remember that we had to use an expensive Dutch font once (more than 
1000 euro for a few files) that was so bugged with respect to its 
encoding (glyphs all over the wrong places) that I had to make a special 
enc vector for it. The vendor didn't even bother to consider the fact 
that the font could be bugged (was probably mostly used in a choose each 
glyph by click and point from a matrix mode).

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2013-03-13  9:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-11 16:51 setups within typescripts: can it be done? Idris Samawi Hamid ادريس   سماوي حامد
2013-03-13  1:01 ` Hans Hagen
2013-03-13  1:37   ` Idris Samawi Hamid ادريس   سماوي حامد
2013-03-13  9:09     ` Hans Hagen

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