FreeCAD Snap Package Font Problems: Fix

I recently went over to using Ubuntu 20.04 from 18.04 and my new FreeCAD installation is now a snap package rather than an installation built using the traditional apt-get install route. I’ve done this for no particular reason other than that is the way thing seem to be going and frankly I just went with the flow. I wanted to get the thing working rather than fuss over how it was installed. But I ran into some Snap package font problems.

I’d used the FreeCAD snap package for a couple of small test projects and all seemed well. Then I decided I needed to make some Christmas lettering on my Trusty Creality Ender 3. To do this all I needed to do was use the ShapeString tool to get the letters from a font on my system. I’ve done this before on Ubuntu 18.04 with a traditionally installed FreeCAD package (See this post). But on Ubuntu 20.04 I hit a road block associated with the FreeCAD snap package.

One of the purposes of the snap packaging format is to limit access to system files. I assume it’s for security reasons and also so the package is not dependent upon a particular system file. This means (as well as enhanced security) that a snap package for Ubuntu should work without issue on any other flavour of Linux as well. That’s the theory anyway.

One problem with this is that Ubuntu/Linux font files are usually in either /usr/share/fonts or /usr/local/share/fonts.

So neither of these system directories are available to the FreeCAD snap package.

Consequently when you try and set up the path to the font of your choice in the ShapeSting tool you will find that the only directories that are available (the rest are greyed out) are those under your home directory. So, in essence you cannot set up the path to the font! While you can actually manually type in the path into the ShapeString tool, when you hit enter you get this:

Screen capture of FreeCAD ShapeScreen font problem setting error
Notice I’ve set the path to /usr/share/fonts. It doesn’t like it!
ShapreString Font problem dialog FreeCAD
Here’s what it actually says at the bottom of the above screen. Yours may be different.

So, how do you access fonts for the ShapeString tool? Well, this below works for me, but I’d be quite happy for anyone to show me a better way.

Basically you have to make the fonts you want to use available from within the bits of the file system that the snap package can see, i.e. anywhere under the user home directory. I’d suggest that it’s best not to copy them directly into the snap package location as you will probably be updating the package sometime and the fonts will be lost if you do that. Instead create (if you don’t have one already) a dot fonts directory (i.e. /home/<user-name>/.fonts) and then copy them in there.

Example:

cd ~
cp -r /usr/share/fonts/msttcorefonts/ ~/.fonts/

So far so good.

Now, go to the FreeCAD snap setup and go to directory:

/home/<user-name>/snap/freecad/current/

In here make soft link to the new fonts directory

ln -s ~/.fonts fonts

Restart FreeCAD

Then when you come to setting up the path to the font of your choice in the ShapeString tool you can now select from anything you have copied into /home/<user-name>/.fonts via the link you have in the freecad setup.

i.e example: either:

/home<user-name>/snap/freecad/current/fonts/mstcorefonts/Comic_Sans_MS_Bold.ttf (or whatever)

or by the other route that the dialog box reveals which is to the current active package version (in my case that is version 22)

/home/<user-name>/snap/freecad/22/fonts/msttcorefonts/Comic_Sans_MS_Bold.ttf

Both of these (actually the same thing!) can be selected using the dialog box associated with setting the font which is triggered by clicking on the three dots next to the font path text box.

After doing the setup you can actually set a default font for the ShapeString tool too. So if you only ever (or mostly) use one font you can set it to that. Otherwise the font path in the ShapeString tool will be blank and need setting up everytime you use it.

Do this by first selecting Draft mode first. If you don’t do this first you won’t be able to set the path for the ShapeString default font.

Now go edit->preferences. You should see a dialog box with “Draft” as the last entry on the left. Click it.

Then select the “Text and Dimensions” tab

Then in the displayed window at the bottom set the Shapestring path to your default font using the three dot navigation tool at the end of the line.

That’s it. Now when you start the ShapeString tool it will load the default font, but you can still replace with another if you want.

I have to say I’m not entirely happy with this as a solution, but it works for me. I hope (failing finding a better solution) it works for you too. If you know a better way to deal with these snap package font problems, I’d love to know what they are.

NOTE: Evidently there is/was a similar problem with the LibreOffice snap, so these Snap package font problems are not just confined to FreeCAD. A suggestion (relating to the LibreOffice problems) was that before copying the fonts to the ~/.fonts directory you run:

sudo fc-cache -fv

This refreshes the cached fonts.

I don’t think that is necessary. Although I doubt if it will do any harm.

Transfer files to Ubuntu with Bluetooth? Here’s How.

So, you want to transfer some files from your phone to your Ubuntu PC using Bluetooth? So did I. In fact I’ve done this setup twice. Both times the painful way.

Some years after I’d solved it with my Moto G5, I forgot it was in my shorts. I went swimming with it. Funnily enough it didn’t seem to work too well (or at all) after that. So I bought a new Moto G10. For my sins (which are many) AND because I’d not written it up, I had to go through the whole grief and suffering again. So from the top. Lets start at the default. Bluetooth is off. Go to Settings. Select Bluetooth. You’ll Get to this screen.

Ubuntu Settings Bluetooth Turned Off
NOTE the barely visible switch in the task bar between “Bluetooth” and the “-“

Fine the barely visible slider switch in the task bar of the setting window slide it to on (i.e. to the right)

You get this

Ubuntu Settings Bluetooth Discovery
A list of discoverable devices appears. Here’s my new G10

Click on the box with the device you want to connect to in it. This pops up:

Ubuntu Settings Bluetooth Connect

Slide the switch by “Connection” to the right. Then you get a code to compare and affirm that appears on both the PC and the phone. Like this:

Ubuntu Settings Blutooth Code match
You need to hit “Confirm”. As I remember a similar box also appears on the phone and you have to confirm that as well.

But.. I Still Can’t transfer Files to Ubuntu with Bluetooth! Arghhh!…

So Now you have ensured Bluetooth is on. You checked that your phone is registered with Ubuntu.

But still the damn thing won’t let you transfer files to your PC from your phone!

Moreover you get one of those really “useful” error messages on your phone like “transfer failed” . If you dig a little deeper on your phone you get a somewhat expanded error message like “ transfer forbidden by target device” Which at least tips you off that the issue is with your Ubuntu box rather than the android phone.

The problem is trivially simple to solve.

Basically Ubuntu will not allow inbound Bluetooth file transfer UNLESS the Bluetooth settings window is open. Like this one:

Ubuntu Settings Open Bluettoh Settings
If this window is not open on the PC then you won’t be able to transfer in files from your phone.

Yes I know. Somewhat bizarre. But there it is.

And that’s it! Now you can transfer files to Ubuntu with Bluetooth from a phone (or whatever). Note: You have to “push” them from the phone. (i.e.instigate the transfer from the phone after the connection is set-up)

Just to make matters worse, on the (Android) smartphone I have, the Bluetooth option to transfer files outbound from the smartphone is not immediately visible when you hit share – it’s on the next line of icons below (i.e. just off-screen) those that are visible at the bottom of the picture (or whatever) you are sharing. You need to flick up the icons to access the Bluetooth icon. Just be careful when you do this that you don’t accidentally close the window as the two gestures are virtually identical.

Then to round it all off the file transfer takes forever. Its far easier/quicker to stick a USB cable into your phone and take the images off that way.

Hope that helps.

I must say, (Bluetooth connectivity – which should be, by definition, simple) drives me to distraction. I don’t plan going swimming with this phone for a few years so I am hoping these notes make sense when I come to change my phone next time.

The rest of my Ubuntu fixs/gotcha’s/howto’s are HERE

Processor overload with YouTube Videos (Ubuntu 18.04)

After endless Googling on this problem I noticed that other people had had similar issues with processor overload with YouTube videos. It appears to be relatively rare. But not unknown. I <think> I’ve found a fix. Or more like – A work-round. So if this helps you then great! But this is strictly WYSIWYG.

Let me start off by saying that this is an unsatisfactory fix. I hate it. It appears to work, but I am unhappy with it as it “gets round” the problem rather than solving it. But beggars can’t be choosers…

Continue reading

Bluetooth File Transfer Problems From Phone to Ubuntu? A Quick Fix.

So, you want to transfer some files from your phone to your Ubuntu PC. But you are getting Bluetooth file Transfer Problems and nothing is getting downloaded to your PC. You have ensured Bluetooth is on. You checked that your phone is registered with Ubuntu. But still the damn thing won’t let you transfer files to your laptop from your phone.

Continue reading

Is RhythmBox Missing Music Files? Here’s a Simple Fix

Nothing drives you more mad than buying some new music and then having to struggle to get it to play. This hit me when Rhythmbox was missing new music files I had added to my Music folder on my Ubuntu 18.04 system. I checked the preferences in Rhythmbox and even though the “watch my library” box was ticked, I got no updates.

Continue reading

Linux: Mounting a USB Drive Manually

Here’s my notes on mounting a USB drive that for some reason fails to mount automatically on Ubuntu.

This would be the case if you plugged in the usb stick and it has not appeared in the “places” tag in the menu bar.

Open a terminal. If you are running in the Gnome GUI you can do this with crtl-alt-t but use whatever method you like.

Continue reading

Ubuntu: start or stop MySql and Apache2 on boot

These are my personal notes on enabling/disabling auto start of Mysql and Apache2 on boot (or other services for that matter). Also on how to start/stop these services after boot. The notes are as they are. I hope you find them useful.

All this is done through a terminal. Open one from the Gnome GUI with:

Ctrl-Alt-t

Continue reading

How to Convert video file format.

(** NOTE: avconv was discontinued after Ubuntu 16.04 so this may not be helpful if you are running a later version. New post soon)

Here are my notes on how to convert video files between mp4 and other file types on Ubuntu. Especially between mp4 and mpg but avi and wmv can be used too.

There are a number of GUI converters in Linux but I’ve always found the command line converters the best. In fact most of the GUI solutions are just front ends on these command line driven converters. GUI tool winff isn’t bad but using command line tools (either avconf and ffmpeg) give you more options.

Continue reading

Ubuntu: Wifi connection has gone missing?

Here’s my personal notes on restoring a Ubuntu (or other linux distro) wifi connection that has gone missing. Maybe they’ll be useful to you too.

Sometimes when Ubuntu comes out of suspend or even after booting from power-on the wifi connection disappears. Usually the little triangular wedge on the task bar is empty. Usually this is easy to fix.

Continue reading