NaviCube: improved style

A forum for research and development of the user interface of FreeCAD

Moderator: agryson

triplus
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: NaviCube: improved style

Postby triplus » Thu Feb 06, 2020 7:20 pm

steve123 wrote:
Thu Feb 06, 2020 3:16 pm
If I turn off the navigation cube in preferences, I can still see through the canvas to the desktop when I mouse over an element in the model view.
Thanks for the feedback and confirming my assumption. This therefore likely isn't NaviCube related and best to open a new thread. It likely comes down to GPU drivers. One thing you can try out is to temporary rename the Mod folder and start FreeCAD after. If the issue will persist, that indicates some other setting isn't involved. Like enabling OpenGL VBO, or some specific render cache strategy in Preferences. To find out where the Mod folder is located, copy and paste this code snippet in FreeCAD Python console:

Code: Select all

FreeCAD.ConfigGet("UserAppData")
Note that you should close all instances of FreeCAD, before renaming the Mod folder.
dxp.dev
Posts: 210
Joined: Tue Dec 11, 2018 12:57 pm

Re: NaviCube: improved style

Postby dxp.dev » Thu Feb 13, 2020 10:34 am

Could we have the text (front/top/...) bigger or bolder ?

Because as it looks right now it's pretty difficult to see (this is not a problem of transparency, more like the size of the font) :


Navicube.png
Navicube with the other menus to compare the size of the font
Navicube.png (230.39 KiB) Viewed 460 times
Navicube 2.png
Navicube alone
Navicube 2.png (4.81 KiB) Viewed 460 times

Or would it be possible to add in Preferences->display (where the navicubes options are) the option to size up the navicube to a certain factor ?

PS: the screenshots were taken on :

OS: macOS Mojave (10.14)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.19541 (Git)
Build type: Release
Branch: master
Hash: a797a4172709b82c6cd08dcf6df86cb789aaa3ce
Python version: 3.8.1
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: C/Default (C)
Imperial system makes no sense, go metric ! ! !
UR_
Posts: 1188
Joined: Tue Jan 03, 2017 8:42 pm

Re: NaviCube: improved style

Postby UR_ » Thu Feb 13, 2020 11:35 am

dxp.dev wrote:
Thu Feb 13, 2020 10:34 am
(this is not a problem of transparency, more like the size of the font) :

Please see here: https://forum.freecadweb.org/viewtopic. ... 10#p364739


Should work meanwhile, if using latest build.
dxp.dev
Posts: 210
Joined: Tue Dec 11, 2018 12:57 pm

Re: NaviCube: improved style

Postby dxp.dev » Thu Feb 13, 2020 12:01 pm

UR_ wrote:
Thu Feb 13, 2020 11:35 am


Please see here: https://forum.freecadweb.org/viewtopic. ... 10#p364739


Should work meanwhile, if using latest build.
Thanks
Imperial system makes no sense, go metric ! ! !
triplus
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: NaviCube: improved style

Postby triplus » Thu Feb 13, 2020 4:25 pm

Note that in the future there will likely be some settings available under Cube menu... -> Settings:

https://forum.freecadweb.org/viewtopic.php?f=34&t=43338
fc_tofu
Posts: 652
Joined: Sun Jan 05, 2020 4:56 pm

Re: NaviCube: improved style

Postby fc_tofu » Sat Mar 28, 2020 3:01 pm

Code of latest NaviCube
https://github.com/FreeCAD/FreeCAD/blob ... viCube.cpp

Line 394-403

Code: Select all

	if (text) {
		ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/NaviCube");
		paint.setPen(Qt::white);
		QFont sansFont(str("Helvetica"), 0.18 * texSize);
		QString fontString = QString::fromUtf8((hGrp->GetASCII("FontString")).c_str());
		if (fontString.isEmpty()) {
			// Improving readability
			sansFont.setWeight(hGrp->GetInt("FontWeight", 87));
			sansFont.setStretch(hGrp->GetInt("FontStretch", 62));
		}
Could some coder explain above code for me please:
1. NaviCube have a font famlily selector parameter now?
2. Non-ASCII (Chinese/CJK/DBCS) are not accepted now?
triplus
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: NaviCube: improved style

Postby triplus » Sat Mar 28, 2020 5:00 pm

Such parameters are now consolidated under NaviCube group. If you want to change the navigation cube text, that is not the correct parameter. Look below, for parameters such as TextFront.

P.S. If you don't want to mess with parameters directly, you can set all this parameters from the cube menu module.
fc_tofu
Posts: 652
Joined: Sun Jan 05, 2020 4:56 pm

Re: NaviCube: improved style

Postby fc_tofu » Sat Mar 28, 2020 7:00 pm

triplus wrote:
Sat Mar 28, 2020 5:00 pm
Such parameters are now consolidated under NaviCube group. If you want to change the navigation cube text, that is not the correct parameter. Look below, for parameters such as TextFront.

P.S. If you don't want to mess with parameters directly, you can set all this parameters from the cube menu module.
Thanks. I am familiar with Parameter Editor already, and I like your CubeMenu addon.
But I cannot find howto replace the default "Helvetica" font (font file, font family, font shape) setting yet.

I mentioned in previous comment, "Helvetica" is not a good choice for NaviCube and FreeCAD.
"Helvetica" is commercial font, and not included in all Windows versions and Linux distros.
So, on Win/Linux, font fallback (auto replaced by other font) is inevitable, and the fallback font is unpredicatible/uncontrollable by end user.
Even on MacOS, where Helvetica is preinstalled, font fallback is still unpredicatible/uncontrollable for non-European locale users. For Helvetica only contains European languages glyphs/scripts.
The font fallback caused 2 bad results:
1, letter space varies in different machines, for different fonts has different width and kerning.
2, font strokes look more vague when falling-back to a Serif-style font, before font hinting implemented on NaviCube. (Serif-style fonts have decorative tiny stoke ends.)
Examples of this 2 results can be easily found in posts by different users.

We have many beautiful open-source fonts already. Why we specify a commercial font in UI design, without providing the font file? Where and how should users get such a commercial font? Below is answer from Adobe Inc.
https://community.adobe.com/t5/indesig ... -p/6887530
Correct Answer by Dov Isaacs | Adobe Employee

To directly respond to your question, there is no “free” version of Helvetica bundled with Windows and the version of Helvetica bundled with MacOS is a .dfont variant of TrueType Helvetica that may problematic for publishing use.

Otherwise, Helvetica is a trademarked, commercial font. It is not “free” and anyone offering you a “free” copy or version of Helvetica is doing so outside the law.

Adobe does not bundle any version of Helvetica with any applications. Nor is it available via TypeKit.

You can license Helvetica, Helvetica Neue, etc. from commercial font vendors including Adobe, Monotype, etc.

If your needs are not exact and you are on a strict budget, Arial may do. Arial is bundled with both Windows and MacOS.
A more fundamental solution to Helvetica fallback problem is to bundle a open-source Sans-style font withint FreeCAD, just like "osifont" in TechDraw.
With i18n/l10n in consideration, Noto Sans (also call "Adobe Source Sans") is the only choice. We only need bundle and specify the English version Noto, users download needed language version Noto to their machine if in need. When FreeCAD locale changed, font fallback will happen from "Noto Sans"(default font family name is English version) to "Noto Sans CJK" (for example) automatically and definitely.
http://www.google.cn/get/noto/
If without i18n/l10n consideration, more opensource Sans-style fonts worth a try, Dejavu Sans, Vera Sans, etc.
Both Noto Sans and Dejavu Sans are pre-installed by lots Linux Distros.
This is not quite a difficult solution.

But for now, I think a font selector parameter is more easy to implement. Is that right?
triplus
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: NaviCube: improved style

Postby triplus » Sat Mar 28, 2020 7:24 pm

Hi @fc_tofu

The usage of name "Helvetica" is not as problematic as it looks like. It's just a string and if such font isn't available on the system it will use a fallback font indeed. And currently it will prefer a serif style font. On why this was selected, likely just the default example from Qt documentation was copy/pasted. As you correctly assumed, AFAIK there is no default font one could set and expect it to work everywhere by default. Likely we won't be packing any additional font for this purpose anytime soon.
fc_tofu wrote:
Sat Mar 28, 2020 7:00 pm
But for now, I think a font selector parameter is more easy to implement. Is that right?
This was already done:
Font.png
Font.png (93.78 KiB) Viewed 179 times
fc_tofu
Posts: 652
Joined: Sun Jan 05, 2020 4:56 pm

Re: NaviCube: improved style

Postby fc_tofu » Sat Mar 28, 2020 7:47 pm

triplus wrote:
Sat Mar 28, 2020 7:24 pm
This was already done:
Awesome, that's just I need.
Further, could Chinese/CJK/DBCS font family name be applied in this setting?
fsc_2020-03-29_033937.jpg
fsc_2020-03-29_033937.jpg (36.89 KiB) Viewed 167 times
I have doubt on "navicube.cpp", line 397,

Code: Select all

QString fontString = QString::fromUtf8((hGrp->GetASCII("FontString")).c_str());