2 Comments

Firefox: Defining font type and size

roystonlodge_Alternate_Mozilla_Browser_Icon

What a professional typesetter knows is the importance of a good font. For centuries typesetters have developed fonts that provide ease of reading that we see in most books today. Having the text look good in the web browser is necessary, choosing the right type and size can make a big difference to how well we read, especially if used quite a bit.

font installation

To make a web page feel right (as was designer had in mind) the fonts should be on your system that a page requires. On many Linux systems the only webfonts installed are the DejaVu fonts which are also the common default Serif, Sans-serif and Monospace fonts for most distros. Adding missing fonts will make a difference to the pages’ look and adds a lot of nice touches to pages that one didn’t know one was missing before. This addon can tell from selected text that type of font that is required on a webpage and what its size is. Basically though most sites still define their fonts as Arial, or sometimes, Verdana, or Georgia that are a part of Microsoft’s core fonts. A few though define theirs with Apple fonts, and a few less with others. These are the most popular webfont groups. To install them (on Arch Linux):

pm i ttf-ms-fonts ttf-vista-fonts ttf-mac-fonts ttf-liberation ttf-google-fonts-distilled ttf-freefont ttf-droid

With MS Core Fonts installed (and a few others) most people will notice a noticably better browser experience becoming available.

Font size

To get a good idea on font size, look at a hardback books fonts and make it about 20% bigger as books are generally two feet away and monitor are a bit more. Also making the different font types about the same height is a good practice as this helps with what is called scanning-expectation (where one expects a font to be when tracking it).

Font type

Being able to select a font that appeals to the users taste is really nice. In Firefox’s settings one can define a preferred font of Serif, Sans-serif, and Monospace. However, it should be known though that many sites still force their own font type and size. The good news is that a greater number of sites are using generic Serif, and Sans-serif, and Monospace definitions so personalizing the look of fonts on a greater scale in the future should be possible. When choosing a font type, pick one depending on what is easy on the eyes rather than one that grabs ones attention (based on readability is what usually works best).

Font tests

Here is a basic test of what Firefox’s base-defined font types and sizes look like:

Font test: Type and size (based defined). (click to view)

Font test: Type and size (based defined). (click to view)

Here are what a few of the basic webfont groups look like:

Font test: Common webfonts group 1. (click to view)

Font test: Common webfonts group 1. (click to view)

Font test: Common webfonts group 2. (click to view)

Font test: Common webfonts group 2. (click to view)

What did I choose?

After adding all the new fonts and testing all the varied ones, surprisingly I found out that overall the MS core fonts were the best. They read beautifully and scale well and just are a pleasure to look at. Ultimately I came up with these settings (font sizes are picked based on a 102 DPI monitor):

Font type Font size
Serif Droid Serif 15
Sans-serif Arial 15
Monospace DejaVu Sans Mono 14
Minimum 11

And it feels great, wouldn’t trade DejaVu Sans Mono for anything. Also I should note that rather than just defining fonts to Firefox, I choose to define my system Serif, Sans-serif, and Monospace fonts (via font config) to point my preferred choices (that is, I don’t need to define them in Firefox). Here is my fontconfig config and it includes my choice of good font to best font in respective order: link.

For GNOME the fonts sizes are:

Default 12
Document 12
Monospace 11
Window Title 13

What they look like:

Font type and size

Font type and size

Common webfont groups 1

Common webfont groups 1

Desktop

Desktop

1 Comment

External monitor as Discrete

I use my laptop primarly at home with an external monitor as discrete, meaning that I have the laptop monitor turned off and I only use it. At times this is also called a dedicated monitor. GNOME can be set to disable the laptop monitor and enable the external but it wasn’t able to hotplug the monitor after I returned the laptop, and at times wouldn’t do so after resuming from sleep. Also in the proccess I discovered that the X.org server DPI setting wasn’t being done correctly and that GNOME’s text scaling needed to be adjusted. So I decided to do it in a script and it turned out to be pretty easy.

I wrote the basic script that toggles monitors depending if the external monitor is present, then it detects correct physical size dimension of the screen so the the correct DPI can be set. After this, I added a startup script (.desktop file), a pm-utils script to runafter resuming, and a udev script to detect andset the monitor when plugged in. The udev rule is generic but appears to be working for a lot of people, it relys on Kernel Mode setting (KMS) so doesn’t work for me wiht the catalyst driver, but every thing else works great. I put it on github for any who like to look at it.

The bash script cannot be used right away instead a couple bit will need to be directed:

 The package cannot be installed directly and be expected to work, some edits
 will need to be made.  First, in the resume script '80_discretemon' a username 
 will need to be defined; next, the monitor names will need to be defined as
 created by the driver in 'discretemon'.

Also, the monitors can be defined in xorg.conf but the fix for after resume from sleep, remains.

Section "Monitor"
  Identifier  "0-LVDS"
  Option      "VendorName" "ATI Proprietary Driver"
  Option      "ModelName"  "Acer Aspire Laptop Screen"
  Option      "DPMS" "true"
  Option      "TargetRefresh" "60"
  Option      "Position" "0 0"
  Option      "Rotate" "normal"
  Option      "Disable" "true"
  DisplaySize  344 194 # only works with xrandr disabled.

EndSection

Section "Monitor"
  Identifier  "0-DFP1"
  Option      "VendorName" "ATI Proprietary Driver"
  Option      "ModelName"  "Samsung SyncMaster SA350"
  Option      "DPMS" "true"
  Option      "PreferredMode" "1920x1080"
  Option      "TargetRefresh" "60"
  Option      "Position" "0 0"
  Option      "Rotate" "normal"
  Option      "Disable" "false"
  DisplaySize  476 268 # only works with xrandr disabled.
  Option      "DPI" "102 x 102"
EndSection
2 Comments

Catalyst Driver, a Journey Taken… Better than I’d Known

I previously read about (a good number of times) people not having the best experiences with AMD’s proprietary driver. However, with my new laptop I decided that no matter how much I love the open-source driver (bought it because AMD opened the specs to it), that realistically it would take a few years before I’d be able to play games with it. The AMD/ATI website says 7xxxM series is supported so I decided to try it.

Prepare for Installing Catalyst

Removed open-source Radeon driver options, commented /etc/X11/xorg.conf.d/20-radeon.conf.

Installing Catalyst Driver

Using Vi0l0’s excellent catalyst repository, I added it to /etc/pacman.conf:

[catalyst] Server = http://catalyst.apocalypsus.net/repo/catalyst/$arch

Add Vi0l0 key:

sudo pacman-key -r          NUM
sudo pacman-key --lsign-key NUM

Installed (using pacman shortcuts script (pm):

pm y
pm i linux-headers catalyst-hook catalyst-utils lib32-catalyst-utils

Using catalyst-hook here to have the module put into initramfs when kernel versions areupgraded (provides catalyst driver).

X.org Server-Configuration

sudo aticonfig --initial 

Added module to load at boot:

echo '# Load AMD Catalyst driver
fglrx' | sudo tee /etc/modules-load.d/fglrx.conf

Disabled Mode Setting: Added GRUB_CMDLINE_LINUX="nomodeset" (for GRUB2) to /etc/default/grub), then:

sudo grub-mkconfig -o /boot/grub/grub.cfg

Testing

Reboot, and driver loaded properly (lsmod | grep fglrx), and direct rendering is enabled (glxinfo | grep direct).

Configuring Display

Created root .desktop for ATI Catylyst Control Center:

cp /usr/share/applications/amdcccle.desktop ~/.local/share/applications/
sed -i 's/Exec=amdcccle/Exec=gksudo amdcccle/' ~/.local/share/applications/amdcccle.desktop
chmod +x ~/.local/share/applications/amdcccle.desktop

Color

  • Color Temperature: Use display’s settings

Display Manager

  • Selected down arrow for both monitors to change to correct settings.

Logout/Login: Gnome 3 crash, extensions disabled
Login: Monitor settings lost, both on lower resolution (open-source radeon driver and catalyst define monitors differently so Gnome using xrandr flubs the first time after.

DTV

  • Pixel Format: RGB 4:4:4 (Full RGB)
  • Adjustments: Overscan 0%

Switchable Graphics

Catalyst driver does not recognize discrete GPU properly, thinks integrated GPU is discrete GPU:

Show GPUs:

aticonfig --list-adapters
* 0. 00:01.0 AMD Radeon HD 6520G          # * Default
  1. 01:00.0 AMD Radeon HD 7600M Series

But…:

aticonfig --px-list
PowerXpress: Discrete GPU is active (High-Performance mode).

I tried using sudo aticonfig --px-igpu to switch to integrated to see if it would switch but got an X.org server hang. Also tried sudo aticonfig --px-dgpu to see if aticonfig --px-list was in error but no luck. Tried using discrete GPU BusID (BusID "PCI:1:0:0") in xorg.conf but that didn’t work either. The catalyst driver doesn’t properly recognize the 7670M GPU as discrete GPU. Entered bug.

GNOME bug

When I first started with GNOME mouse clicks would miss at times and sometimes keypresses did too, I added export CLUTTER_VBLANK=none to ~/.bash_profile and it fixed this. Oddly, I commented it later because I thought it might be related to another bug (it was not) and forgot to enable it again, but I haven’t seen the problem since.

Conclusion

Hard to believe there is not official AMD Catalyst bugzilla (odd how their website points to the unofficial one) so I’m a bit worried about the near future but think all will be fine.

The driver works good. I’m getting a consistent 50fps on Urban Terror and tried Doom and it looks pretty good. Disappointed about not being able to use the discrete GPU, would have been nice. Gonna keep using catalyst, its working good.

Here’s a script i built called gpuswitch I plan to use when gaming later. Night.

Resources

3 Comments

The Beauty of rsync and Backup Script

rsync is a command-line tool used to copy/clone files (“fast incremental file transfer“). It is a great, simple backup tool. The basic rsync command is this:

rsync -a src dest_dir

Where src is the original directory or file and dest_dir is the destination directory. Because rsync does incremental backups it only adds the file to the dest if it has been updated from the original backup.

rsync -axS src dest_dir

This is the command I use. This command can be used to backup just about anything! The options:

  • -a means archive mode which basically means to preserve the file “as is” (same permissions…)
  • -x means not to cross file systems boundaries
  • -S means to handle sparse files efficiently
  • -v option (verbose) can be used to print what rsync is doing

An important note about rsync: when src is a directory a trailing slash (/) tells rsync to copy the “contents” of the directory:

rsync -axS src_dir/ dest_dir
ls -1 dest_dir/
 file1
 file2

Without a trailing slash:

rsync -axS src_dir dest_dir
ls -1 dest_dir
 src_dir

rsync can also use file-lists containing paths of directories and files, to both include and exclude them for backup:

sudo rsync -axS --files-from="incl_file.txt" --exclude-from="excl_file.txt" src_dir dst_dir

src_dir will have to be specified and will have to be relative to paths in the file list:

cat incl_file.txt
Desktop/
rsync -axS --files-from="incl_file.txt" --exclude-from="excl_file.txt" /home/user/ dst_dir

rsync can also remove files from the dest_dir with the --delete option, so files that get added to the exclude file or taken out of the include file will removed from dest_dir.

rsync -axS --delete-excluded --files-from="incl_file.txt" --exclude-from="excl_file.txt" /home/user/ dst_dir

Backup Script

I use rsync to backup my system configurations and /home/ to make reinstalling easy. I created the script to remember the command to use, but to also easily add to the include and exclude files:

bcksysc i /etc/hostname 
 Added "/etc/hostname" to bcksysc-inc.txt include file.

Syntax:

bcksysc 
 bcksysc  - backup configurations
 i - add to the include list a file or folder
 e - add to the exclude list a file or folder
 c - create backup

Here’s the script all that needs to be done is to change the Parent Destination Directory (for backing up /home/ I copied the script to bckhome, changed the type to home and added /home/ to the include file):

So my destination directory looks like this:

ls -1 /run/media/todd/Backup/rsync/
 ...
 aspire_2012-08-31_sysc
 aspire_2012-08-31_home
3 Comments

Screencasting Done Easy (Desktop Recording)

I got to test out a good number of screencasting applications and I found a good one, and as usual the easiest was the best. I started with recordMyDesktop.

recordMyDesktop

recordMyDesktop is a basic program that works good. The GTK version has a simple UI that sets a border around the area to be recorded. I has sound recording too.

A minor thing but of note is that the window detection area is off when selecting a windows, but the reason I didn’t use recordMyDesktop was because I found the quality wasn’t that good. It could be because it uses .ogv format, or perhaps it had something to do with my system.

This is and example I did with recordMyDesktop and though it’s enlarged (OpenShot doesn’t have the ability to use the original size) the quality I wanted to be better.

Others

I tried Istanbul and a couple others all with about the same recording results. Istanbul hasn’t been developed in several years and though I got excited about xvidcap it hasn’t been developed in years either. xvidcap grabs screenshots and then concatenates them into a video. I got excited because xvidcap’s preview uses Imagemagick’s animate tool to preview the video and it was real nice. Unfortunately very little works in xvidcap anymore but taking the screenshots. To put them together I used:

fmpeg -i out%04d.xwd -r 15 -vcodec huffyuv test.avi

unfortunately the quality was no better than that of the others.

FFmpeg

The great command line tool to encode and decode video ffmpeg can also do screencasts and I read a lot of how people liked it (and I do too). To use it it’s real basic:

ffmpeg -f x11grab -s wxga -i :0.0 -sameq screencast.mpg

The quality isn’t quite what I want it to be, but I’ve seen other people have nice looking screencasts so I think it must be either my video card or my video driver.

This line can be amended some for better quality, performance, and add sound recording. Using the raw, lossless codecs for video and audio improves processor usage for better FPS recording:

ffmpeg -f x11grab -s wxga -i :0.0 -vcodec huffyuv -sameq -acodec pcm_s16le -f alsa -i pulse -ac 2 screencast.avi
  • -s and -i are for size and input. -s will give the dimensions and -i will define the co-ordinates. wxga is a definition of a video resolution standard (available ones are listed in man ffmpeg)
  • -r can be added to define the frame rate. Default is 25 and is good. Only reason really to change it is if frames are dropped during recording (marked with red).
  • -follow_mouse 100 can be added to follow mouse movements. 100 is the border in pixels that must be reached before the area is moved.

ffcast and FFmpeg

ffcast is a program that grabs and passes X.org server dimensions and co-rodinates to other programs. It has built-in support to pass these parameters for some programs including ffmpeg. So the command will now look like this:

ffcast -s ffmpeg -- -vcodec huffyuv -sameq -acodec pcm_s16le -f alsa -i pulse -ac 2 screencast.avi

ffcast’s -s option will prompt for the screen area and then pass the dimensions and co-orodinates to ffmpeg using --.

Now to make this easy, I put this in a bash script, it runs as such:

 screencast <a|f|m|w> - create screencasts (a)rea (f)ull-screen (m)ouse (w)indow

Here’s the bash script:

An example:

1 Comment

cVLC as Default Video Player



I love MPlayer. I’ve been using it for years. Whenever I needed to watch a video from my camera or downloaded something from YouTube it always did great. However, I revisited recently trying to play a DVD with MPlayer after having gone through a lengthy setup process a ways back and discovered MPlayer still cannot play DVD’s reliably. From the examples I tried it seemed as error-prone as before.

MPlayer always ran dependably and with almost no resources, videos would pop rightup. Learning to use the keyboard to navigate Mplayer was likely having one big remote control. However, I came to the decision that I cannot deal with the quirks of MPlayer anymore (there is good work on the mplayer2 project that is trying to fix a lot of the internal plumbing problems of MPlayer) but I needed something more-reliable. So when I decided just to use VLC, I accidentally learned about clvc.

I don’t normally use VLC because I use GNOME. Having MPlayer open up immediately was a big plus, but with clvc (which is part of the VLC package) videos open just like they did with MPlayer. And the playback quality is good. To play a DVD:

cvlc dvd://

The big thing is I’m going to have to learn all the key mappings again for cvlc, so a made a reference sheet:

Key Mappings

Desktop Recognition

To have clvc be recognized by the desktop a .desktop needs to be created:

and put in ~/.local/share/applications.

sudo update-desktop-database -q

Warning: I had to put it in /usr/share/applications/ for GNOME 3.6 to be able to recognize it in Default Applications and Removable media. This is likely a bug.

To have all known video types that VLC knows and define them to cVLC as the default application do:

xdg-mime default cvlc.desktop $(grep -oP 'video.*?;' /usr/share/applications/vlc.desktop | tr ';\n' ' ')

Load on DVD Insertion

I have yet to find out how to do this. This probably isn’t the correct way to do it, but it should work (note: my install is busted a bit right now so unable to test). Put in /usr/share/applications/clvc-dvd.desktop:)

[Desktop Entry]
Type=Application
Name=cVLC
GenericName=Media Player
GenericName[ca]=Reproductor multimèdia
GenericName[de]=Medienwiedergabe
GenericName[fr]=Lecteur multimédia
GenericName[it]=Lettore multimediale
GenericName[ja]=メディアプレーヤー
X-GNOME-FullName=Command Line VLC
Comment=Play movies and songs
Icon=vlc
TryExec=cvlc dvd://
Exec=cvlc dvd:// %U
Terminal=false
Type=Application
Categories=AudioVideo;Player;Recorder;
MimeType=video/dv;video/mpeg;video/x-mpeg;video/msvideo;video/quicktime;video/x-anim;video/x-avi;video/x-ms-asf;video/x-ms-wmv;video/x-msvideo;video/x-nsv;video/x-flc;video/x-fli;video/x-flv;video/vnd.rn-realvideo;video/mp4;video/mp4v-es;video/mp2t;application/ogg;application/x-ogg;video/x-ogm+ogg;audio/x-vorbis+ogg;application/x-matroska;audio/x-matroska;video/x-matroska;video/webm;audio/webm;audio/x-mp3;audio/x-mpeg;audio/mpeg;audio/x-wav;audio/x-mpegurl;audio/x-scpls;audio/x-m4a;audio/x-ms-asf;audio/x-ms-asx;audio/x-ms-wax;application/vnd.rn-realmedia;audio/x-real-audio;audio/x-pn-realaudio;application/x-flac;audio/x-flac;application/x-shockwave-flash;misc/ultravox;audio/vnd.rn-realaudio;audio/x-pn-aiff;audio/x-pn-au;audio/x-pn-wav;audio/x-pn-windows-acm;image/vnd.rn-realpix;audio/x-pn-realaudio-plugin;application/x-extension-mp4;audio/mp4;audio/amr;audio/amr-wb;x-content/video-vcd;x-content/video-svcd;x-content/video-dvd;x-content/audio-cdda;x-content/audio-player;application/xspf+xml;x-scheme-handler/mms;x-scheme-handler/rtmp;x-scheme-handler/rtsp;
X-KDE-Protocols=ftp,http,https,mms,rtmp,rtsp,sftp,smb
Keywords=Player;Capture;DVD;Audio;Video;Server;Broadcast;
NoDisplay=True

and then point to it in Removable Media > DVD.

YouTube videos

VLC has it’s own parser to be able to extract URL’s from YouTube so running is all that is needed to get the job done:

cvlc "http://www.youtube.com/..."
Leave a comment

Architectural Intent – a Wallpaper Tile



I tend to use my desktop as my workspace so I like wallpapers that act as more of a background decoration rather than elaborate artwork. So I created this. This is based on a wallpaper I found on the net (sorry, can’t remember where) and I re-did it. The original was in jpeg format and it had a bit of dithering to it.

It’s real basic, just 140×140, but I tile it and it comes out real nice:

It’s a vector image so it’s able to be resized real easy if need be.



Follow

Get every new post delivered to your Inbox.

Join 52 other followers