Re: Set the font size from home directroy

From: Robert <ro....at.web.de>
Date: Tue, 22 Jun 2010 22:06:42 +0200

On Tue, Jun 22, 2010 at 5:25 PM, Ryan Pusztai <rpusz....at.gmail.com> wrote:
> Mitchell,
>
> On Tue, Jun 22, 2010 at 11:04 AM, mitchell <mforal.n....at.gmail.com> wrote:
>>
>> Well the idea would be to pick the theme you like, copy it to your
>> ~/.textadept/themes/ folder, and modify the theme from there. You do
>> not have to modify 3 themes unless you use them all.
>>
>> Scintillua's lexer Lua state is separate from Textadept's, so the only
>> way to modify fonts from init.lua would be through calls to Scintilla
>> via buffer.style_*. However, I doubt those settings would persist.
>>
>
> Thanks for the quick reply and explanation. It would be very nice if someday
> it were possible to change things in the lexer, but I completely understand.
> I will just make the theme "my own" (copy it from the install to
>  ~/.textadept/themes/ directory)
> --
> Regards,
> Ryan
>

You could add the following to your init.lua:

events.connect('buffer_after_switch', function()
  local c = _SCINTILLA.constants
  local buffer = buffer
  buffer.zoom = 2
  buffer.margin_width_n[0] = 4 + 3 * buffer:text_width(c.STYLE_LINENUMBER, '9')
end
)

This would (as an example) increase the font size by two points and
should work even if you change your theme and without requiring you to
copy over the theme files to your userhome.

From luadoc:
buffer.zoom: The zoom level added to all font sizes. +: magnify, -: reduce.

It's a bit of a hack, and I'm not sure if that's the best event to
connect this to. If you create a new view it has the default size
again so you would have to connect to that too, connecting to
buffer_new and file_opened would be another alternative.
(How about chainable events, Mitchell?)

I only tested this briefly but maybe this is an alternative.

Robert
Received on Tue 22 Jun 2010 - 16:06:42 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:49:08 EST