Please test PR #3150: @font and @color bugs

38 views
Skip to first unread message

Edward K. Ream

unread,
Mar 17, 2023, 10:55:27 AM3/17/23
to leo-editor
PR #3150 fixes problems with `@color` and `@font` settings.

Apparently @font settings have not been working for a year or more. In that sense, the changes are minor. However, I have taken care not to require any changes to theme files. In that sense the changes could have had major consequences.

Changes to some @font settings

Imo there was no way to get everything to work properly without changing some aspect of @font settings. I'll omit the horrendous complications.

The new code enforces (assumes) that @font settings pertaining to syntax coloring must have one of the forms:

  @font <tag>
  @font <language>.<tag>

where <tag> is one of the values of the default_font_dict in leoColorizer.py.  Some examples:

  @font comment1
  @font rest.comment1

The body of such nodes should contain one or more settings. For example, for the @color rest.comment node:

  # Note: the default font size is 12.
  rest_comment1_family = None
  rest_comment1_size = 12pt
  rest_comment1_slant = italic
  rest_comment1_weight = None

This is all documented in leoSettings.leo, where the context may be clearer. Note that settings whose values are None have no effect: they use reasonable, unsurprising defaults.

Summary

PR #3150 shouldn't break any existing settings, wherever they may be defined (in theme files, myLeoSettings.leo, etc.)

@font settings for syntax coloring should have one of the forms:

  @font <tag>
  @font <language>.<tag>

As always, these settings may appear in all the usual places.

There should be no need to change theme files, but the new @font settings should work in theme files.

Please test the new code and report any problems. I'll wait a few days before merging this PR into devel.

Edward

Thomas Passin

unread,
Mar 17, 2023, 11:53:44 AM3/17/23
to leo-editor
I'm very confused here.
On Friday, March 17, 2023 at 10:55:27 AM UTC-4 Edward K. Ream wrote:
PR #3150 fixes problems with `@color` and `@font` settings.

Apparently @font settings have not been working for a year or more. In that sense, the changes are minor. However, I have taken care not to require any changes to theme files. In that sense the changes could have had major consequences.

Changes to some @font settings

Imo there was no way to get everything to work properly without changing some aspect of @font settings. I'll omit the horrendous complications.

The new code enforces (assumes) that @font settings pertaining to syntax coloring must have one of the forms:

  @font <tag>
  @font <language>.<tag>

where <tag> is one of the values of the default_font_dict in leoColorizer.py.  Some examples:

  @font comment1
  @font rest.comment1

- There is no default_font_dict in leoColorizer.py. There is only leo_color_database.
- There is no color comment1 in that dictionary.  I think you may have meant to word the sentence differently.
 
The body of such nodes should contain one or more settings. For example, for the @color rest.comment node:

  # Note: the default font size is 12.
  rest_comment1_family = None
  rest_comment1_size = 12pt
  rest_comment1_slant = italic
  rest_comment1_weight = None

 - Just above, you wrote that the syntax was rest.comment1.  Now you write that it is rest_comment1_family.  ???
- Why would an @color node contain font specifications?  Shouldn't they be in an @font node?

This is all documented in leoSettings.leo, where the context may be clearer. Note that settings whose values are None have no effect: they use reasonable, unsurprising defaults.

It's not documented in leoSettings.leo.  The only documentation I can find (in the referenced PR) is

"@font settings for particular languages must have the form @font <language-name>.<tag>
where <tag> is one of the tags in the default_font_dict in leoColor.py." 

Please give us some actual working examples.  For example, suppose I want rest headlines to be 16 pt cyan Boldoni font.  What settings do I need to add to a theme file to achieve that?

Edward K. Ream

unread,
Mar 17, 2023, 12:14:24 PM3/17/23
to leo-e...@googlegroups.com
On Fri, Mar 17, 2023 at 10:53 AM Thomas Passin <tbp1...@gmail.com> wrote:

- There is no default_font_dict in leoColorizer.py.

It's defined in the node BaseColorizer.defineDefaultFontDict in leoColorizer.py.
 
> The body of such nodes should contain one or more settings. For example, for the @color rest.comment node:

My apologies. I should have said @font rest.comment node

>> This is all documented in leoSettings.leo, where the context may be clearer.

> The only documentation I can find (in the referenced PR) is

"@font settings for particular languages must have the form @font <language-name>.<tag>
where <tag> is one of the tags in the default_font_dict in leoColor.py."

Yes, that's right.

> Please give us some actual working examples.
> For example, suppose I want rest headlines to be 16 pt cyan Boldoni font.  What settings do I need to add to a theme file to achieve that?

You would use your existing settings to do that, same as always.

My theme file contains these settings (headlines):

@string font-family = DejaVu Sans Mono, Inconsolata, Droid Sans Mono
@string font-family-body = @font-family
@string font-family-tree = @font-family
@string font-size-tree = 12pt

The new code doesn't change those settings. So set your settings accordingly. Or leave them alone :-)

Remember, the new code shouldn't affect your theme files. The new code only affects syntax-coloring.

Edward

Edward K. Ream

unread,
Mar 17, 2023, 1:06:03 PM3/17/23
to leo-editor
On Friday, March 17, 2023 at 9:55:27 AM UTC-5 Edward K. Ream wrote:

> PR #3150 fixes problems with `@color` and `@font` settings.

I buried the lede. Except for some @color and @font settings, all settings and theme files should work exactly as before.

Please let me know if your your theme files are affected in any way.

Edward

Edward K. Ream

unread,
Mar 21, 2023, 11:22:45 AM3/21/23
to leo-editor
On Friday, March 17, 2023 at 9:55:27 AM UTC-5 Edward K. Ream wrote:

> PR #3150 fixes problems with `@color` and `@font` settings.
...
> Please test the new code and report any problems. I'll wait a few days before merging this PR into devel.

Hearing no complaints I have merged this PR into devel. Please let me know if any of your theme files act differently.

Edward
Reply all
Reply to author
Forward
0 new messages