Arabic Fonts in Emacs

If you are like Ammar or me and use Emacs to write in both Arabic and English, you might have encountered the problem of using some Arabic font in Emacs and wished that you could use that font but you can't because the English text looks terrible, or vice versa. Well, I found a little trick in Emacs that allows you to assign a font for Arabic text and another font for English text.

There's a function in Emacs called set-fontset-font that allows us to specify a range of characters to have a specific font. To assign the Arabic range to have Noto Sans Arabic UI font, for example. All you have to do is to add the following somewhere in your init.el if you are using Emacs, or in dotspacemacs/user-init in your .spacemacs file if you are using spacemacs:

(let ((ar-font "Noto Sans Arabic UI")
      (range '(#x000600 . #x0006FF)))
  (set-fontset-font "fontset-startup"  range ar-font)
  (set-fontset-font "fontset-default"  range ar-font)
  (set-fontset-font "fontset-standard" range ar-font))

Site Update

It has been almost three years since I posted anything here. I've decided to revive my blog and do some updates here and there. I got a new domain instead of the old one and now the site supports the https protocol (thanks to Let's Encrypt). I was using Pelican to generate my blog. However, this time I've decided to go with Nikola, mainly for two reasons:

  1. Nikola has good Org mode support,
  2. Nikola has good multilingual support.

I've been using Spacemacs (An Emacs distribution) to do most of my work for the past two to three years now and I wanted to make publishing new posts as easy as possible. So after trying some ideas and workflows, I've settled on using Nikola with Org mode. Also, I'm planning to publish (hopefully) every post in English and Arabic, so Nikola support for multilingual blogs was a must for me.

Computer Science?

What is computer science? is it a scientific discipline? or an engineering discipline? or is it a form of Art? I tried to answer these questions with a small presentation that I gave at the university and I thought should share the slides of that presentation. So, grab it from here.

Docker NuPIC

Docker and NuPIC

UPDATE Right now nupic is available at PyPi and can be simply installed by:

pip install nupic

I just set up a docker image that will provide an easy development environment for the NuPIC project. The image comes with the following:

  • NuPIC
  • NuPIC Studio
  • iPython notebook
  • Matplotlib
  • MySQL server

The docker image is available at the docker hub here. And the Dockerfile is at github with all the instructions to use.

Wacom Intuos Pro and Linux

Intuos Pro

wacom intuos pro

So a new year and I got my self a little gift, a Wacom Intuos pro. I'm upgrading from an Intuos 3 so my opinions could be a little out of date.

Here is a couple of pictures of the pen and the pen holder.

wacom intuos pro pen and pen holderwacom intuos pro pen

The cool thing about the pen is the different nibs that you can use. As you can see in the picture below, the nibs are stored in the pen holder and you can choose the one that best suits your style.

wacom intuos pro holde and nibs

The Intuos pro comes in three different sized. I got the small one because it's cheaper :P and I wanted a compact tablet that I can easily carry with me if I want to. The tablet surface feels like paper and It's definitely an improvement over the Intuos 3.

wacom intuos pro table

Another thing that I really like about the Intuos pro is the ability to have it work wirelessly. Underneath the tablet there is a removable battery and a compartment for the wireless dongle. You can remove the battery and the wireless dongle if you want to work in wired mode. The battery is charged via the USB cable in wired mode.

wacom intuos pro table

Here are closer pictures of the wireless and USB dongle.

wacom intuos pro tablewacom intuos pro table

Installation and Configuration

The main purpose of this blog post is to show how I got the tablet to work under Linux. I'm using Arch at the moment and when I plugged the tablet in, it did't work. I had to mess with it a bit to get it working.

Driver installation

First off, you need to install the wacom drivers. So run the following command which will install the drivers form the main repos.

sudo pacman -S xf86-input-wacom

Kernel module installation

Then you have to install this kernel module. Thanks to apicici for maintaining this. It's not in the official repos but you can get it from AUR. I'm using yaourt here, but you can use whatever AUR manager you have. Also, you have to have the kernel headers installed before this step, if you don't have them already.

sudo pacman -S linux-headers
sudo yaourt -S input-wacom-dkms

Desktop environment configuration

I use KDE now and there's a cool KCM (KConfig Modules) for the wacom tablet in the AUR. To get it run the following:

sudo yaourt -S kcm-wacomtablet

Here is a screen shot of it:

Wacom KCM

The tablet could be used as a big touchpad. While it's good to have the option, it's not really practical because the palm rejection isn't working. So I think disabling the touchpad is better, for now at least. You can do so as shown in the screen shot below:

Wacom KCM

One awesome feature of this KCS, is the ability to have profiles. Here I have some shortcuts for MyPaint.

Wacom KCM

So this is it, have fun!

wacom intuos pro table


Thanks to Vasco Alexander Basqué for pointing out that the Intuos pro needs xf86-input-wacom version 0.23 or newer. It won't work with older drivers.