how to convert font size to pt number ?
style={\switchtobodyfont[somefont,somefontsize]} digests font sizes expressed in pt. What's the command to convert font sizes ( for example \tfc ) to their corresponding pt number ? Alan
On Sat, 12 Jul 2008, Alan Stone wrote:
style={\switchtobodyfont[somefont,somefontsize]} digests font sizes expressed in pt.
What's the command to convert font sizes ( for example \tfc ) to their corresponding pt number ?
See http://wiki.contextgarden.net/Font_Switching#Font_sizes Aditya
Thanks for your quick response Aditya. I've read that too and unfortunately don't find anything on that page that answers my question. Hmmm... Either the question was not clear enough or I've been smoking the carpet... :O) Let's try to formulate it otherwise... With somefont defined through \definetypeface[somefont][...] style={\switchtobodyfont[somefont,huge]} gives a compile error, only, for example, style={\switchtobodyfont[somefont,14pt]} works like in \setuphead[chapter][style={\switchtobodyfont[somefont,14pt]}] I don't want to manually input some pt size but, for example, the \tfc or huge corresponding pt size. Therefore I'm looking for - the ConTeXtMagicCommand to convert \ConTexTMagicCommand[\tfc or huge] to "\tfc or huge size expressed in pt" or - some other ConTeXtSuperMagic trick to display the chapter heading in somefont and \tfc or huge size I guess I could \chapter{\tfc chaptertitle}, however I'm looking for something more generic so I only have to input chapter{chaptertitle}. Cheers, Alan
Am 2008-07-12 um 23:06 schrieb Alan Stone:
I guess I could \chapter{\tfc chaptertitle}, however I'm looking for something more generic so I only have to input chapter{chaptertitle}.
What's wrong with \setuphead[chapter][style=\tfc] % or style={\tfc\yourfont} ? Greetlings from Lake Constance! Hraban --- http://www.fiee.net/texnique/ http://wiki.contextgarden.net https://www.cacert.org (I'm an assurer)
Am 12.07.2008 um 23:20 schrieb Henning Hraban Ramm:
Am 2008-07-12 um 23:06 schrieb Alan Stone:
I guess I could \chapter{\tfc chaptertitle}, however I'm looking for something more generic so I only have to input chapter{chaptertitle}.
What's wrong with \setuphead[chapter][style=\tfc] % or style={\tfc\yourfont}
\definefont[chapterfont][yourfont sa 1.728] \setuphead[chapter][style=chapterfont] Regards, Wolfgang
On Sat, 12 Jul 2008, Alan Stone wrote:
Thanks for your quick response Aditya.
I've read that too and unfortunately don't find anything on that page that answers my question.
Hmmm...
Either the question was not clear enough or I've been smoking the carpet... :O)
I wanted to say that by default, \tfa = 1.2 times \tf size, tfb is 1.44 times \tf size, tfc = 1.728 times \tf size, tfd = 2.074 times \tf size, and tfe = 2.488 times \tf size. So you can always use (in a 10 point document) \definefont[chapterfont][Sans sa 1.728] \setuphead[chapter][style=chapterfont]
Let's try to formulate it otherwise...
With somefont defined through \definetypeface[somefont][...]
style={\switchtobodyfont[somefont,huge]} gives a compile error, only, for example, style={\switchtobodyfont[somefont,14pt]} works
like in \setuphead[chapter][style={\switchtobodyfont[somefont,14pt]}]
I don't want to manually input some pt size but, for example, the \tfc or huge corresponding pt size.
Therefore I'm looking for
- the ConTeXtMagicCommand to convert \ConTexTMagicCommand[\tfc or huge] to "\tfc or huge size expressed in pt"
or
- some other ConTeXtSuperMagic trick to display the chapter heading in somefont and \tfc or huge size
The default values of \tfa etc can be changed by \definefont. If these values have not been changed, then you can use: \definefont[chapterfont][Sans sa \magfactor3] \setuphead[chapter][style=chapterfont] \magfactor is defined in font-ini.tex as \def\magfactor#1% {\ifcase#1 1.000\or1.200\or1.440\or1.728\or2.074\or2.488\or1\fi} so \magfactor 3 is equal to \tfc in size. You can also use a more plain TeX like syntax as \definefont[chapterfont][Sans scaled \magstep3] where \magstep is defined in font-ini.tex as \def\magstep#1% {\ifcase#1 \@m\or1200\or1440\or1728\or2074\or2488\or\@m\fi} Aditya
On Sat, 12 Jul 2008, Aditya Mahajan wrote:
On Sat, 12 Jul 2008, Alan Stone wrote:
Thanks for your quick response Aditya.
I've read that too and unfortunately don't find anything on that page that answers my question.
Hmmm...
Either the question was not clear enough or I've been smoking the carpet... :O)
I wanted to say that by default, \tfa = 1.2 times \tf size, tfb is 1.44 times \tf size, tfc = 1.728 times \tf size, tfd = 2.074 times \tf size, and tfe = 2.488 times \tf size. So you can always use
(in a 10 point document)
This will actually work for any sized document.
\definefont[chapterfont][Sans sa 1.728] \setuphead[chapter][style=chapterfont]
Aditya
Simple solutions from generous posters. Thanks all. I was too focussed on the switchtobodyfont command. Have a great weekend, Alan
(1) \setupbodyfont[somebodyfont,12pt] \definefont[chapterfont][somefont sa 1.728] \setuphead[chapter][style=chapterfont] gives a compile error at \chapter{chapter title} : ! Font \**chapterfont**:=somefont at 20.736pt not loadable: metric data not found or bad However \setuphead[chapter][style=\tfc\somefont] works OK. \setupbodyfont[somefont,12pt] also work OK, while \setupbodyfont[chapterfont,12pt] defaults to LM font Uh ? (2) fc-list output extract Times New Roman:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,thường,Arrunta Times New Roman:style=Italic,cursiva,kurzíva,kursiv,Πλάγια,Kursivoitu,Italique,Dőlt,Corsivo,Cursief,kursywa,Itálico,Курсив,İtalik,Poševno,nghiêng,Etzana Times New Roman:style=Bold,Negreta,tučné,fed,Fett,Έντονα,Negrita,Lihavoitu,Gras,Félkövér,Grassetto,Vet,Halvfet,Pogrubiona,Negrito,Полужирный,Fet,Kalın,Krepko,đậm,Lodia Times New Roman:style=Bold Italic,Negreta cursiva,tučné kurzíva,fed kursiv,Fett Kursiv,Έντονα Πλάγια,Negrita Cursiva,Lihavoitu Kursivoi,Gras Italique,Félkövér dőlt,Grassetto Corsivo,Vet Cursief,Halvfet Kursiv,Pogrubiona kursywa,Negrito Itálico,Полужирный Курсив,Tučná kurzíva,Fet Kursiv,Kalın İtalik,Krepko poševno,nghiêng đậm,Lodi etzana With the following typescript \starttypescript[serif][timesnewroman] % --- MS TrueType Core Font --- \definefontsynonym[Dummy][name:Times New Roman][features=default] \definefontsynonym[DummyBold][name:Times New Roman Bold][features=default] \definefontsynonym[DummyItalic][name:Times New Roman Italic][features=default] \definefontsynonym[DummyBoldItalic][name:Times New Roman Bold Italic][features=default] \stoptypescript \starttypescript[serif][timesnewroman][name] \definefontsynonym[Serif][Dummy][features=default] \definefontsynonym[SerifBold][DummyBold][features=default] \definefontsynonym[SerifItalic][DummyItalic][features=default] \definefontsynonym[SerifBoldItalic][DummyBoldItalic][features=default] \definefontsynonym[SerifSlanted][DummyItalic][features=default] \definefontsynonym[SerifIBoldSlanted][DummyBoldItalic][features=default] \definefontsynonym[SerifCaps][Dummy][features=default] \stoptypescript \definetypeface[myBodyFont][rm][serif][timesnewroman][default] \bf displays in bold italic (??) so something is wrong/missing. Seems to be something with the style=... stuff. Fruitlessly searched the wiki and mailing list archive. Alan
Am 13.07.2008 um 13:16 schrieb Alan Stone:
(1) \setupbodyfont[somebodyfont,12pt] \definefont[chapterfont][somefont sa 1.728] \setuphead[chapter][style=chapterfont]
gives a compile error at \chapter{chapter title} :
! Font \**chapterfont**:=somefont at 20.736pt not loadable: metric data not found or bad
somefont is only a placeholder for a real font name or a style like Serif, Sans ...
However
\setuphead[chapter][style=\tfc\somefont] works OK.
\setuphead[chapter][style=\tfc\somefont] \starttext \chapter{Chapter} \stoptext This gives me a error message, give us working samples.
\setupbodyfont[somefont,12pt] also work OK, while
How should we know, it's hard to give you an answer with just one line of code.
\setupbodyfont[chapterfont,12pt] defaults to LM font
Uh ?
You have no typeface with the name 'chapterfont'.
(2) fc-list output extract
Times New Roman:style = Regular ,Normal ,obyčejné ,Standard ,Κανονικά ,Normaali ,Normál ,Normale ,Standaard ,Normalny,Обычный,Normálne,Navadno,thường,Arrunta Times New Roman:style = Italic ,cursiva ,kurzíva ,kursiv ,Πλάγια ,Kursivoitu ,Italique ,Dőlt ,Corsivo ,Cursief ,kursywa,Itálico,Курсив,İtalik,Poševno,nghiêng,Etzana Times New Roman:style = Bold ,Negreta ,tučné ,fed ,Fett ,Έντονα ,Negrita ,Lihavoitu ,Gras ,Félkövér ,Grassetto ,Vet ,Halvfet ,Pogrubiona ,Negrito,Полужирный,Fet,Kalın,Krepko,đậm,Lodia Times New Roman:style=Bold Italic,Negreta cursiva,tučné kurzíva,fed kursiv,Fett Kursiv,Έντονα Πλάγια,Negrita Cursiva,Lihavoitu Kursivoi,Gras Italique,Félkövér dőlt,Grassetto Corsivo,Vet Cursief,Halvfet Kursiv,Pogrubiona kursywa,Negrito Itálico,Полужирный Курсив,Tučná kurzíva,Fet Kursiv,Kalın İtalik,Krepko poševno,nghiêng đậm,Lodi etzana
With the following typescript
\starttypescript[serif][timesnewroman] % --- MS TrueType Core Font --- \definefontsynonym[Dummy][name:Times New Roman] [features=default] \definefontsynonym[DummyBold][name:Times New Roman Bold] [features=default] \definefontsynonym[DummyItalic][name:Times New Roman Italic] [features=default] \definefontsynonym[DummyBoldItalic][name:Times New Roman Bold Italic][features=default] \stoptypescript
\starttypescript [serif] [timesnewroman] \definefontsynonym [TimesNewRoman-Regular] [name:Times New Roman] [features=default] \definefontsynonym [TimesNewRoman-Italic] [name:Times New Roman Italic] [features=default] \definefontsynonym [TimesNewRoman-Bold] [name:Times New Roman Bold] [features=default] \definefontsynonym [TimesNewRoman-BoldItalic] [name:Times New Roman Bold Italic] [features=default] \stoptypescript
\starttypescript[serif][timesnewroman][name] \definefontsynonym[Serif][Dummy][features=default] \definefontsynonym[SerifBold][DummyBold][features=default] \definefontsynonym[SerifItalic][DummyItalic][features=default] \definefontsynonym[SerifBoldItalic][DummyBoldItalic] [features=default] \definefontsynonym[SerifSlanted][DummyItalic] [features=default] \definefontsynonym[SerifIBoldSlanted][DummyBoldItalic] [features=default] \definefontsynonym[SerifCaps][Dummy][features=default] \stoptypescript
\starttypescript [serif] [timesnewroman] \setups[font:fallback:serif] \definefontsynonym [Serif] [TimesNewRoman-Regular] \definefontsynonym [SerifItalic] [TimesNewRoman-Italic] \definefontsynonym [SerifBold] [TimesNewRoman-Bold] \definefontsynonym [SerifBoldItalic] [TimesNewRoman-BoldItalic] \stoptypescript
\definetypeface[myBodyFont][rm][serif][timesnewroman][default]
\starttypescript [timesnewroman] \definetypeface [timesnewroman] [rm] [serif] [timesnewroman] [default] \stoptypescript \usetypescript[timesnewroman] \setupbodyfont[timesnewroman] \starttext text \bf text \it text \bi text \stoptext
\bf displays in bold italic (??) so something is wrong/missing. Seems to be something with the style=... stuff. Fruitlessly searched the wiki and mailing list archive.
Wolfgang
participants (4)
-
Aditya Mahajan
-
Alan Stone
-
Henning Hraban Ramm
-
Wolfgang Schuster