[Eric] font settings shift when saving a new file

Darren Dale dsdale24 at gmail.com
Tue Jul 22 19:07:15 BST 2008


On Tuesday 22 July 2008 12:37:40 pm you wrote:
> On Montag, 21. Juli 2008, Darren Dale wrote:
> > Hi Detlev,
> >
> > On Monday 21 July 2008 01:32:20 pm Detlev Offenbach wrote:
> > > On Montag, 21. Juli 2008, Darren Dale wrote:
> > > > Hello,
> > > >
> > > > When I create a new file, the fonts initially respect the settings
> > > > from the preferences dialog, which is DejaVu Sans Mono (same font for
> > > > all eric4's fonts, and I have the "use monospace as default" box
> > > > checked). When I save this new file (as .py or .c, for example), the
> > > > fonts change from monospaced to some kind of sans serif. If I close
> > > > the file and reopen it, I get the monospaced fonts back.
> > > >
> > > > Its a minor issue, but its been around for as long as I can remember.
> > > > I probably should have reported it earlier. I'm currently using the
> > > > 4.2 release candidate.
> > >
> > > In order to track it down, I have to have more info.
> > >
> > > 1. When you edit the file, what is the language set to?
> >
> > How do I find this information? I think it is english utf8, and my locale
> > is US_en, which eric complains about when I start from the command line:
> >
> > Warning: translation file 'qt_en_US'could not be loaded.
> > Using default.
> > Warning: translation file 'eric4_en_US'could not be loaded.
> > Using default.
> > Warning: translation file 'qscintilla_en_US'could not be loaded.
> > Using default.
>
> Oops, I meant the programming language, e.g. Python (see editor context
> menu, Language)

Oh, ok. Its python.

> > > 2. Do you have a lexer configured for e.g. Python (if saving to .py)?
> >
> > yes, I am using the defaults and .py is set to Python, c to C++
> >
> > > 3. Is there a font set to a kind of sans serif?
> >
> > No, all my fonts are set to DejaVu sans mono.
> >
> > > 4. If possible step by step instructions because I haven't seen this
> > > yet.
> >
> > It's really simple to run into on my machine:
> >
> > open eric
> > click file->new button or menu option
> > type jibberish
> > save as .py
> > fonts have changed
>
> That is normal beacuse:
>
> 1. When file is opened, it is not associated with a lexer. Therefore, the
> default font is used (see Editor->Styles configuration page).
> 2. When it is saved as .py, it is associated with the Python lexer and the
> fonts and colors of this lexer is used.
>
> Does this explain your observation?

Partially. If I close the file, and then reopen it, I get my monospaced fonts 
back. I did not realize that you had such control over the fonts for the 
various lexers. So as it stands, I have DejaVu sans mono set for all of my 
editor/style(1) fonts, which seems to give me monospaced fonts when I open an 
existing python file, and I have these python-specific settings which only 
take effect when I save a new file as .py.

I think there is some conflicting configuration going on, but I think I can 
work around it. Thanks for pointing out the lexer-specific settings.

Darren


More information about the Eric mailing list