Re: [code] [textadept] Theming

From: Robert <rob.g.att.web.de>
Date: Tue, 25 Jun 2013 17:47:51 +0200

On Fri, Jun 21, 2013 at 9:53 PM, Mitchell <m.att.foicica.com> wrote:
>> * What do you think about having a font adjusting API like
>>
>> set_theme(theme, font, fontsize) e.g.
>>
>> set_theme('darker', 'Monaco', 12)
>>
>> The last two options would be optional and would otherwise be set to
>> the values now present in each theme.
>
>
> Something more powerful is now in hg. `gui.set_theme()` accepts optional
> key-value argument pairs for properties. In your case, you would call it
> like this:
>
> gui.set_theme('darker', 'font', 'Monaco', 'fontsize', 12)

This is indeed more powerful -- but I was hoping this could replace
the setting of fonts in theme files.
Maybe the font setting could still be moved into 'gui.set_theme'?

  for i = 1, #_VIEWS do
    gui.goto_view(i)
    dofile(name)
    property['font'], property['fontsize'] = 'Bitstream Vera Sans Mono', 10
    if WIN32 then
      property['font'] = 'Courier New'
    elseif OSX then
     property['font'], property['fontsize'] = 'Monaco', 12
    end
    for j = 1, #props, 2 do buffer.property[props[j]] = props[j + 1] end
  end

This would avoid code duplication and prevent theme authors from
messing with the default fonts.

Cheers,
Robert

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Tue 25 Jun 2013 - 11:47:51 EDT

This archive was generated by hypermail 2.2.0 : Wed 26 Jun 2013 - 06:39:25 EDT