Giter Club home page Giter Club logo

Comments (17)

kintel avatar kintel commented on July 18, 2024

We are requesting a Typewriter font, which should prefer a fixed pitch font, also on Windows: https://github.com/openscad/openscad/blob/master/src/mainwin.cc#L1800

Are you sure the font isn't overridden in the preferences?

from openscad.

brad avatar brad commented on July 18, 2024

Yep, here are the registry contents when OpenSCAD was loaded:
REGEDIT4

[HKEY_CURRENT_USER\Software\OpenSCAD]

[HKEY_CURRENT_USER\Software\OpenSCAD\OpenSCAD]
"recentFileList"=hex(7):5a,3a,2f,6d,65,64,69,61,2f,63,6f,64,65,2f,6f,70,65,6e,
73,63,61,64,2d,6d,61,73,74,65,72,2f,74,65,73,74,32,2e,73,63,61,64,00,00

[HKEY_CURRENT_USER\Software\OpenSCAD\OpenSCAD\view]
"orthogonalProjection"="false"

[HKEY_CURRENT_USER\Software\OpenSCAD\OpenSCAD\window]
"position"="@point(67 55)"
"size"="@SiZe(800 600)"

[HKEY_CURRENT_USER\Software\OpenSCAD\OpenSCAD\window\splitter1sizes]
"size"=dword:00000002

[HKEY_CURRENT_USER\Software\OpenSCAD\OpenSCAD\window\splitter1sizes\1]
"entry"=dword:0000018e

[HKEY_CURRENT_USER\Software\OpenSCAD\OpenSCAD\window\splitter1sizes\2]
"entry"=dword:0000018e

[HKEY_CURRENT_USER\Software\OpenSCAD\OpenSCAD\window\splitter2sizes]
"size"=dword:00000002

[HKEY_CURRENT_USER\Software\OpenSCAD\OpenSCAD\window\splitter2sizes\1]
"entry"=dword:00000175

[HKEY_CURRENT_USER\Software\OpenSCAD\OpenSCAD\window\splitter2sizes\2]
"entry"=dword:000000bb

To test the Ubuntu native version I deleted ~/.config/OpenSCAD/OpenSCAD.conf to start from defaults and the initial font was "DejaVu Sans"

My config file contains the following:

[editor]
fontsize=0

[view]
orthogonalProjection=false

[window]
size=@SiZe(800 600)
position=@point(0 24)
splitter1sizes\1\entry=397
splitter1sizes\2\entry=397
splitter1sizes\size=2
splitter2sizes\1\entry=381
splitter2sizes\2\entry=191
splitter2sizes\size=2

So it seams that QT isn't doing the job correctly? According to http://doc.trolltech.com/4.6/qfont.html#fontmatching the font matching algorithm is:

  1. The specified font family is searched for.
  2. If not found, the styleHint() is used to select a replacement family.
  3. Each replacement font family is searched for.
  4. If none of these are found or there was no styleHint(), "helvetica" will be searched for.
  5. If "helvetica" isn't found Qt will try the lastResortFamily().
  6. If the lastResortFamily() isn't found Qt will try the lastResortFont() which will always return a name of some kind.

Not sure where it's failing in there. My system doesn't have Helvetica, so for all I know it could be getting to the very last step and choosing the lastResortFamily. Any ideas how I can test further? Is there a list somewhere of fonts that classify as "Typewriter" fonts?

from openscad.

kintel avatar kintel commented on July 18, 2024

On Dec 28, 2011, at 21:46 PM, Brad Pitcher wrote:

So it seams that QT isn't doing the job correctly? According to http://doc.trolltech.com/4.6/qfont.html#fontmatching the font matching algorithm is:

It looks like we were inheriting the default font of QTextEdit.
I've committed a fix - it should work better now, but only tested on Mac.

-Marius

from openscad.

kintel avatar kintel commented on July 18, 2024

uh:
"Qt does not support style hints on X11 since this information is not provided by the window system."

I'm now forcing the font to fixed pitch, unless a concrete family is selected.

from openscad.

brad avatar brad commented on July 18, 2024

This didn't fix the issue for me. The default is still "Deja Vu Sans" in Ubuntu.

from openscad.

donbright avatar donbright commented on July 18, 2024

how can i tell which font its loading?

from openscad.

brad avatar brad commented on July 18, 2024

Go to Edit->Preferences and select the Editor tab

from openscad.

donbright avatar donbright commented on July 18, 2024

d'oh.. thanks.

is there a fixed-width font that all ubuntu versions have? i can try to do some testing but dont know much about fonts.

from openscad.

brad avatar brad commented on July 18, 2024

I assume they all have "DejaVu Sans Mono" but we should be thinking about other distros too right?

from openscad.

donbright avatar donbright commented on July 18, 2024

oh... good point.. . . . thanks for the info.

my brain is fried at the moment. i will try to make a patch in a few days.

from openscad.

donbright avatar donbright commented on July 18, 2024

Here is an experimental patch to fix the bug reported.

#57

It chooses a specific substring for a font name depending on the OS.

On linux, it looks for anything with the word 'Mono' in the name

On Windows, it looks for anything with the word 'Console' in the name

On Mac it looks for anything named 'Monaco' in the name.

it doesn't use SetFont in mainwin.cc, because that gets overridden anyways by Preferences.cc constructor and Preferences.cc updategui. Even if there are no preferences set, and there is no .config file in existence, the Preferences code pulls the default font from the OS, regardless of SetFont in mainwin.cc.

from openscad.

brad avatar brad commented on July 18, 2024

I pulled the updates from openscad master and it works great mostly.
In Ubuntu, my default font was "Andale Mono"
In windows (wine) my default font was fixed pitch, but when I went to the preferences to see what font it was, it showed "MS Sans Serif" to be the font in use, which was definitely not true.
Any idea why it would show a different font from the font that is actually in use?
I wonder also if it's just a wine issue.

from openscad.

donbright avatar donbright commented on July 18, 2024

d'oh i think the problem might be that it's looking for "Console" named fonts in Wine because it thinks it's Windows. Wine though uses the Linux fonts, so Console won't be there... so i have no idea what it's doing.

Do you know where it stores the OpenSCAD.conf file in Wine? If I can figure out how to erase that and restart in Wine i think i can track it down and fix this bug.


scratch that, i found it,,, its in the registry (!) .

will debug tonight. thanks

from openscad.

brad avatar brad commented on July 18, 2024

Yeah, it stores the openscad configuration in the registry: [HKEY_CURRENT_USER\Software\OpenSCAD]

I would think getting this to work with wine shouldn't be a high priority though, there's no reason for anyone to use it with wine.

from openscad.

donbright avatar donbright commented on July 18, 2024

if my code breaks in wine it will probably break in windows some day. besides this wont take long.

i found this really cool page here:

http://www.codestyle.org/css/font-family/sampler-Monospace.shtml

from openscad.

donbright avatar donbright commented on July 18, 2024

thanks very much for reporting this bug. it would have shown up on any system where the default attempt didnt match a system font (not just wine). it should be fixed in this patch:

https://github.com/openscad/openscad/pull/58/files

from openscad.

brad avatar brad commented on July 18, 2024

Thanks Don, it looks good in Wine now. Default font for me was "Courier New", I wouldn't have guessed it was fixed pitch.

from openscad.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.