Re: @Font trumps @B & @I (which is a pity)

Mark Summerfield <[email protected]>
Newsgroups gmane.comp.type-setting.lout
Organization Qtrac Ltd.
Message-ID <20101012171307.36c200e8@dino>
On Tue, 12 Oct 2010 12:07:55 +0200
[email protected] (Ludovic Courtès) wrote:
> Hi Mark,
> 
> Mark Summerfield <[email protected]> writes:
> 
> > def @VSChar right x{{VenusSymbol Base}@Font{@Char x}}
> 
> [...]
> 
> > doesn't work (as noted); but nor does
> >
> > @ScopedBold{@VSChar{alpha} @VSChar{gamma}}
> 
> That’s because @VSChar should check the current value of the
> ‘boldicity’ context variable and choose whether to use ‘Base’ or
> ‘Bold’ based on that.

Ooops, thanks, that works great!

The actual defs I've used are:

def @VSChar right x{
    {@GetContext scopeState} @Case {
    bold @Yield {{VenusSymbol Bold}@Font{@Char x}}
    italic @Yield {{VenusSymbol Slope}@Font{@Char x}}
    else @Yield {{VenusSymbol Base}@Font{@Char x}}
    }
}
def @ScopedBold right x {
  { scopeState @Yield bold } @SetContext {
    { @GetContext scopeState } @Case {
      bold @Yield {@B{x}}
      else  @Yield {x}
    }
  }
}
def @ScopedItalic right x {
  { scopeState @Yield italic } @SetContext {
    { @GetContext scopeState } @Case {
      italic @Yield {@I{x}}
      else  @Yield {x}
    }
  }
}

This is because in my use case these things can only be roman, bold, or
italic, but not bold and italic.

However, whenever I use @VSChar{} lout outputs a warning:

no value for context variable `scopeState', using the empty string

I solved this by enclosing the whole para in:

{scopeState @Yield @Null}@SetContext{
... # Used @ScopedBold & @ScopedItalic
}

But what I'd really like to do is set the scopeState globally for the
whole document.

Thanks!

-- 
Mark Summerfield, Qtrac Ltd, www.qtrac.eu
    C++, Python, Qt, PyQt - training and consultancy
        "Programming in Python 3" - ISBN 0321680561
            http://www.qtrac.eu/py3book.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.