<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0" xml:base="http://levien.zonnetjes.net/?q=feeds/articles/rss.xml">
  <channel>
    <title />
    <link>http://levien.zonnetjes.net/?q=feeds/articles/rss.xml</link>
    <description />
    <language>en</language>
          <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/lvzon" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="lvzon" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
    <title>Assorted Ubuntu Problems (and how to solve them)</title>
    <link>http://levien.zonnetjes.net/?q=ubuntuproblems</link>
    <description>&lt;p&gt;I've been running Ubuntu as my main operating system for over 5 years now, and I must say I love it. However, every OS has its problems, and Ubuntu is no exception. Here's a few I ran into, and how I solved them (or not).&lt;/p&gt;
&lt;h2&gt;Lucid Lynx (10.04 LTS)&lt;/h2&gt;
&lt;h3&gt;Adobe Flash&lt;/h3&gt;
&lt;p&gt;The Adobe Flash-plugin has a history of problems of 64-bit systems. When I upgraded to Lucid, the controls of many Flash-based websites suddenly stopped working. Very annoying. The solution was to install a recent 64-bit version of the Flash-pluginfrom the &lt;a href="https://launchpad.net/~sevenmachines/+archive/flash"&gt;sevenmachines Flash PPA&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;sudo add-apt-repository ppa:sevenmachines/flash &amp;amp;&amp; sudo apt-get update &amp;amp;&amp; sudo apt-get install flashplugin64-installer&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;WARNING:&lt;/b&gt; This version has a &lt;a href="http://www.adobe.com/support/security/advisories/apsa10-01.html"&gt;serious security flaw&lt;/a&gt;, which may cause your system to be compromised. Unfortunately Adobe hasn't released new 64-bit Linux versions of the Flash-plugin, so for the time being we seem to be stuck with either the 32-bit plugin (which seems to be the one causing the problems on 64-bit systems), or a working 64-bit one with a security hole. For now I've followed Adobe's advice and "patched" the security issue in the 64-bit plugin by deleting the offending authplay library: &lt;code&gt;sudo rm /opt/Adobe/Reader9/Reader/intellinux/lib/libauthplay.so*&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Alternatively, try using the &lt;a href="http://flash-aid-extension.blogspot.com/"&gt;FLASH-AID Firefox extension&lt;/a&gt; to install the appropriate newest version of Flash. See also: &lt;a href="http://ubuntuforums.org/showthread.php?t=1466854" title="http://ubuntuforums.org/showthread.php?t=1466854"&gt;http://ubuntuforums.org/showthread.php?t=1466854&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/lvzon/~4/jxGdOkKxvpw" height="1" width="1"/&gt;</description>
     <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/1">article</category>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/2">technical</category>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/7">ubuntu</category>
 <pubDate>Tue, 22 Jun 2010 21:49:38 +0000</pubDate>
 <dc:creator>levien</dc:creator>
 <guid isPermaLink="false">39 at http://levien.zonnetjes.net</guid>
  </item>
  <item>
    <title>Use and abuse of the Facebook "Like"-code</title>
    <link>http://levien.zonnetjes.net/?q=fblike</link>
    <description>&lt;p&gt;A while ago I noticed that a lot of my Facebook friends "liked" a page called "This Man Took A Photo Of Himself Everyday For 15 Years In A Row, Look at the Results!", or something similar. Curious as to what that was about, I clicked on the link. It transferred me to a page that, in addition to embedding the (rather cool) video &lt;a href="http://vimeo.com/106228"&gt;"Living My Life Faster" by JK Keller&lt;/a&gt; (don't worry, harmless link), added itself to my "liked" pages without my approval...&lt;/p&gt;
&lt;p&gt;Then this week I saw the same thing happen again, this time with a page called "O.M.F.G.! You Won't Believe What I Saw At WalMart Today.." or "The Guy With The Biggest Pecker On Earth" (both at craziestattoos.blogspot.com, possibly unsafe link), and another one called  "What Mary-Kate Olsen Looks Like As E.T.! LMAO" (funny-celeb-pics.blogspot.com, also possibly unsafe - thanks Folkert for testing that one ;).&lt;/p&gt;
&lt;p&gt;It turns out that the new "Like" mechanism that Facebook introduced recently allows not only Facebook content but also &lt;a href="http://developers.facebook.com/docs/reference/plugins/like"&gt;external pages to have a "Like" button&lt;/a&gt;. For example, I added one to the bottom of this page using the &lt;a href="http://drupal.org/node/779498"&gt;fb_like module for Drupal&lt;/a&gt; (still in development, but does kind of work).&lt;/p&gt;
&lt;p&gt;While this is nice, it seems that this feature can quite easily be abused. It's not hard to hide the Like-button (which is loaded from the Facebook site in an iframe) by putting an opaque HTML-element over it. Various Javascript-tricks can then be used to let your browser "click" on the hidden Like-button without your (explicit) approval. This technique has been termed &lt;a href="http://www.sophos.com/security/analyses/viruses-and-spyware/trojiframeet.html"&gt;"clickjacking"&lt;/a&gt;. Usually you won't notice this until you check your own Newsfeed. The first two sites that I saw doing this seemed harmless enough, but the one at craziestattoos.blogspot.com employed a large amount of Javascript-code with an unknown purpose. It's not hard to imagine sites with all kinds of malicious content employing this trick to spread themselves through your social network...&lt;/p&gt;
&lt;p&gt;Of course any link can lead to a site with malicious content, so there's no reason to become overly paranoid. And I would expect that Facebook will employ some kind of blacklist or automatic security scanning eventually. But the fact that this is needed is a bit lame. Also, it would take a while for sites to be added to a blacklist, leaving plenty of opportunity for them to go "viral". &lt;/p&gt;
&lt;p&gt;So I guess the bottom line is: if you see that a lot of your Facebook-friends suddenly "Like" a page, be weary before you click on it. It's always a good idea to check where the link leads first! Your browser will tell you when you hover your mouse over it, usually in the bottom left corner. If you're not sure it's safe, just copy the link and then log out of Facebook before visiting it. Malicious pages will usually ask you to click on something to continue (thus activating the Like-button). If you're not logged in to Facebook, you'll see a login-window pop up, and you'll know that it's a malicious page (or at least one that tries to do something behind your back).&lt;/p&gt;
&lt;p&gt;If you forgot to log out and don't trust it after having visited a page, check if it has added itself to your "liked" pages afterwards. You can see and edit all your "liked" pages by clicking "Edit my profile" in the top-left Facebook menu, then "Likes and interests" and then "Show other pages" at the bottom of the page, just above "Save changes".&lt;/p&gt;
&lt;p&gt;Here's a list of the clickjacking sites I came across so far:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;This Man Took A Photo Of Himself Everyday For 15 Years In A Row, Look at the Results! (mediasconnect.com)&lt;/li&gt;
&lt;li&gt;O.M.F.G.! You Won't Believe What I Saw At WalMart Today.. (craziestattoos.blogspot.com)&lt;/li&gt;
&lt;li&gt;The Guy With The Biggest Pecker On Earth (craziestattoos.blogspot.com)&lt;/li&gt;
&lt;li&gt;What Mary-Kate Olsen Looks Like As E.T.! LMAO (funny-celeb-pics.blogspot.com)&lt;/li&gt;
&lt;li&gt;15 Worst Construction Mistakes EVER MADE! (construction-mistakes.info)&lt;/li&gt;
&lt;li&gt;Finally: The Dislike Button is Here! (&lt;a href="http://www.dislike-btn.info" title="www.dislike-btn.info"&gt;www.dislike-btn.info&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://feeds.feedburner.com/~r/lvzon/~4/_i02-b0So3M" height="1" width="1"/&gt;</description>
     <comments>http://levien.zonnetjes.net/?q=fblike#comments</comments>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/1">article</category>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/15">security</category>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/2">technical</category>
 <pubDate>Tue, 01 Jun 2010 17:14:55 +0000</pubDate>
 <dc:creator>levien</dc:creator>
 <guid isPermaLink="false">38 at http://levien.zonnetjes.net</guid>
  </item>
  <item>
    <title>Useful graphics software</title>
    <link>http://levien.zonnetjes.net/?q=gfxbookmarks</link>
    <description>&lt;p&gt;Here is a list of some graphics software I find useful:&lt;/p&gt;
&lt;h2&gt;Raster graphics&lt;/h2&gt;
&lt;p&gt;&lt;a href="http://www.gimp.org"&gt;The GIMP&lt;/a&gt; A cross-platform photo and image editor&lt;br /&gt;
&lt;a href="http://photobatch.stani.be"&gt;Phatch&lt;/a&gt; A cross-platform photo batch processor&lt;br /&gt;
&lt;a href="http://irfanview.de/"&gt;IrfanView&lt;/a&gt; An excellent image viewer and batch processor for Windows (which runs fine under Wine as well)&lt;/p&gt;
&lt;h2&gt;Vector graphics&lt;/h2&gt;
&lt;p&gt;&lt;a href="http://www.inkscape.org/"&gt;Inkscape&lt;/a&gt; A cross-platform vector graphics editor, which is easy to use&lt;br /&gt;
&lt;a href="http://www.sk1project.org/"&gt;sK1&lt;/a&gt; Another cross-platform vector graphics editor, aimed more at professional graphics designers&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/lvzon/~4/WGvW45pnKbI" height="1" width="1"/&gt;</description>
     <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/1">article</category>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/14">graphics</category>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/11">resource</category>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/2">technical</category>
 <pubDate>Thu, 27 May 2010 11:35:47 +0000</pubDate>
 <dc:creator>levien</dc:creator>
 <guid isPermaLink="false">37 at http://levien.zonnetjes.net</guid>
  </item>
  <item>
    <title>OSS4 on Ubuntu (Lucid Lynx)</title>
    <link>http://levien.zonnetjes.net/?q=oss4</link>
    <description>&lt;p&gt;After upgrading to Ubuntu 10.4 LTS, I was happy to notice that audio in all applications (including Skype) was finally working perfectly! However, I was less happy to notice that Pulseaudio was using quite a lot of CPU-time, and that the sound quality was absolutely awful... So I decided to give &lt;a href="http://www.opensound.com"&gt;OSS4&lt;/a&gt; a try. After some googling, installing a few packages and some minor configuration, OSS4 was up and running, and I must admit the improvement in sound quality is rather significant!&lt;br /&gt;
&amp;lt;!--break--&gt;&lt;br /&gt;
To minimise the hassle, I decided to set up ALSA emulation, and initially I kept Pulseaudio as well. I configured applications with native OSS support (e.g. Audacious) to output to OSS4 directly. With the settings below, Gnome applications that use Gstreamer should output directly to OSS4 as well. Everything else will probably either use the ALSA libraries or Pulseaudio, both of which now output to OSS4. However, in the end I removed Pulseaudio altogether as the applications I used did not really require it...&lt;/p&gt;
&lt;p&gt;Here's how I did it:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In a terminal, run &lt;code&gt;sudo dpkg-reconfigure linux-sound-base&lt;/code&gt;&lt;br /&gt;
Choose OSS. This should, among other things, prevent the ALSA modules from loading. Reboot.&lt;/li&gt;
&lt;li&gt;There are (at least) three ways to install OSS4:
&lt;ul&gt;
&lt;li&gt;Install from the Ubuntu repositories: &lt;br /&gt;
&lt;code&gt;sudo apt-get install oss4-base oss4-dkms oss4-source oss4-gtk&lt;/code&gt;&lt;br /&gt;
This will automatically rebuild the OSS modules when your kernel is updated, and is the preferred way of installing third-party kernel modules. However, the oss4-dkms package is currently broken for Ubuntu (&lt;a href="https://bugs.launchpad.net/ubuntu/+source/oss4/+bug/519577"&gt;bug #519577&lt;/a&gt;), so for the time being use the package from the Opensound website (recommended, see below) or &lt;a href="https://launchpad.net/~sevenmachines/+archive/release+1"&gt;from this PPA&lt;/a&gt; (not recommended as it currently breaks sound in the Adobe Flash plugin). &lt;/li&gt;
&lt;li&gt;Download the OSS4 binaries as a DEB package from &lt;a href="http://www.opensound.com/download.cgi" title="http://www.opensound.com/download.cgi"&gt;http://www.opensound.com/download.cgi&lt;/a&gt; and install it. This is currently the easiest way, but you'll manually need to reinstall the package every time your kernel is updated. Also, this package is not GPL but has a commercial one-year license.&lt;/li&gt;
&lt;li&gt;Fetch the source from the Mercurial repository and compile the package yourself, as described in &lt;a href="https://help.ubuntu.com/community/OpenSound" title="https://help.ubuntu.com/community/OpenSound"&gt;https://help.ubuntu.com/community/OpenSound&lt;/a&gt; &lt;br /&gt;
This will give you the latest GPL-version of the drivers.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;If you get errors about snd_pcm being in use, try rebooting and running &lt;code&gt;sudo soundon&lt;/code&gt;. If the problem persists, use &lt;code&gt;lsmod&lt;/code&gt; to check if any ALSA modules are still loaded. If so, blacklist them manually. For instance, I had to blacklist the saa7134_alsa module by creating a configuration file /etc/modprobe.d/blacklist-saa7134_alsa.conf with the line &lt;code&gt;blacklist saa7134_alsa&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Either configure Pulseaudio to use OSS4 or remove it altogether.
&lt;ul&gt;
&lt;li&gt;To configure Pulseaudio with OSS4:&lt;br /&gt;
Edit the default configuration file: &lt;code&gt;gksu gedit /etc/pulse/default.pa&lt;/code&gt;&lt;br /&gt;
Comment out the modules for automatic hardware detection.&lt;br /&gt;
Add the following line: &lt;br /&gt;&lt;code&gt;load-module module-oss device="/dev/dsp" sink_name=output source_name=input mmap=0&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;To remove Pulseaudio:&lt;br /&gt;
&lt;code&gt;sudo apt-get remove pulseaudio&lt;/code&gt;&lt;br /&gt;
You will have to manually restore the volume manager icon to your panel later.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Configure Gstreamer for OSS4 output:&lt;br /&gt;
Install &lt;code&gt;gstreamer0.10-plugins-bad&lt;/code&gt;&lt;br /&gt;
Run &lt;code&gt;gstreamer-properties&lt;/code&gt; and set input and output to OSS.
&lt;/li&gt;
&lt;li&gt;Set up ALSA (or rather libasound) to output through OSS4 instead of the native ALSA drivers. Create a configuration file:&lt;br /&gt; &lt;code&gt;gedit ~/.asoundrc&lt;/code&gt;&lt;br/&gt;&lt;br /&gt;
Insert the following:&lt;/br/&gt;&lt;/li&gt;
&lt;pre&gt;
 pcm.!default
 {
   type oss
   device /dev/dsp
 }
 mixer.!default
 {
   type oss
   device /dev/dsp
 }

&lt;/pre&gt;&lt;li&gt;Add the following PPA to your Software Sources and run update-manager: &lt;a href="https://launchpad.net/~dtl131/+archive/ppa" title="https://launchpad.net/~dtl131/+archive/ppa"&gt;https://launchpad.net/~dtl131/+archive/ppa&lt;/a&gt; &lt;br /&gt;
This will enable Gnome audio output and volume management to use Gstreamer instead of Pulseaudio. &lt;/li&gt;
&lt;li&gt;Right-click over your panel, select "Add to panel" and add the volume control applet. Alternatively, you can add a button to your panel or menu to start the OSS4 mixer (&lt;code&gt;/usr/bin/ossxmix&lt;/code&gt;) instead of the normal Gnome volume manager.&lt;/li&gt;
&lt;li&gt;Configure applications that natively support it (e.g. Audacious, Audacity, Kdenlive, SMPlayer, VLC, Wine, etc.) to &lt;a href="http://www.opensound.com/wiki/index.php/Configuring_Applications_for_OSSv4"&gt;use OSS output&lt;/a&gt;. Many applications don't (or no longer) have native support for OSS. This is no problem, these should continue to work fine through Gstreamer or ALSA emulation (or Pulseaudio if you decide to keep it).&lt;/li&gt;
&lt;li&gt;After removing Pulseaudio, it could be that Rhythmbox or Movie Player start to complain about missing audiosink plugins. In that case you'll need to manually change some Gconf-keys. Start &lt;code&gt;gconf-editor&lt;/code&gt;. Open system/gstreamer/0.10/audio/default. Check if any keys (e.g. musicaudiosink and chataudiosink) are still set to "pulsesink". If so, change them to "osssink".&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That's all! Sit back and enjoy your much improved audio quality. :-)&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;If (for whatever reason) you decide that you want to switch back to the old situation with ALSA and Pulseaudio, here's how to do it:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In a terminal, run &lt;code&gt;sudo dpkg-reconfigure linux-sound-base&lt;/code&gt;&lt;br /&gt;
Choose ALSA. Reboot.&lt;/li&gt;
&lt;li&gt; Remove the libasound configuration file: &lt;code&gt;rm ~/.asoundrc&lt;/code&gt;&lt;/li&gt;
&lt;li&gt; Reinstall Pulseaudio and associated packages: &lt;code&gt;sudo apt-get install pulseaudio indicator-sound libcanberra-pulse pulseaudio pulseaudio-esound-compat pulseaudio-module-bluetooth pulseaudio-module-gconf pulseaudio-module-x11 ubuntu-desktop ppa-purge&lt;/code&gt;&lt;/li&gt;
&lt;li&gt; Restore the original Pulse-based Gnome volume manager: &lt;code&gt;sudo ppa-purge ppa:dtl131/ppa&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Configure Gstreamer for Puseaudio output by running &lt;code&gt;gstreamer-properties&lt;/code&gt; and setting input and output to PulseAudio.&lt;/li&gt;
&lt;li&gt; If you manually configured applications (e.g. Audacious, Audacity, Kdenlive, SMPlayer, VLC, Wine, etc.) to use OSS4, switch them back to Pulseaudio or ALSA-output. &lt;/li&gt;
&lt;li&gt; Start &lt;code&gt;gconf-editor&lt;/code&gt;. Open system/gstreamer/0.10/audio/default. Check if any keys (e.g. musicaudiosink and chataudiosink) are set to "osssink". If so, change them to "pulsesink".&lt;/li&gt;
&lt;li&gt; Remove the OSS4 package using Synaptic or with &lt;code&gt;sudo apt-get remove oss-linux&lt;/code&gt;. Optionally you can also remove &lt;code&gt;gstreamer0.10-plugins-bad&lt;/code&gt; and &lt;code&gt;ppa-purge&lt;/code&gt; now. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For instance, I had to revert back to ALSA on one of my machines, because the OSS4-driver for my Nvidia HDA audio chipset failed to recognise its microphone-input... It may also be smart to revert back to the original situation before upgrading your distribution (I haven tried that yet).&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;b&gt;References:&lt;/b&gt; &lt;br /&gt;
&lt;a href="https://help.ubuntu.com/community/OpenSound" title="https://help.ubuntu.com/community/OpenSound"&gt;https://help.ubuntu.com/community/OpenSound&lt;/a&gt; &lt;br /&gt;
&lt;a href="http://www.opensound.com/wiki/index.php/Configuring_Applications_for_OSSv4" title="http://www.opensound.com/wiki/index.php/Configuring_Applications_for_OSSv4"&gt;http://www.opensound.com/wiki/index.php/Configuring_Applications_for_OSSv4&lt;/a&gt; &lt;br /&gt;
&lt;a href="http://insanecoding.blogspot.com/2009/06/state-of-sound-in-linux-not-so-sorry.html" title="http://insanecoding.blogspot.com/2009/06/state-of-sound-in-linux-not-so-sorry.html"&gt;http://insanecoding.blogspot.com/2009/06/state-of-sound-in-linux-not-so-...&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://ubuntuforums.org/showthread.php?t=1561576" title="http://ubuntuforums.org/showthread.php?t=1561576"&gt;http://ubuntuforums.org/showthread.php?t=1561576&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/lvzon/~4/NqP8WlaHwNY" height="1" width="1"/&gt;</description>
     <comments>http://levien.zonnetjes.net/?q=oss4#comments</comments>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/1">article</category>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/5">howto</category>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/2">technical</category>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/7">ubuntu</category>
 <pubDate>Fri, 07 May 2010 12:31:14 +0000</pubDate>
 <dc:creator>levien</dc:creator>
 <guid isPermaLink="false">36 at http://levien.zonnetjes.net</guid>
  </item>
  <item>
    <title>Printing a multi-page CD booklet</title>
    <link>http://levien.zonnetjes.net/?q=cdbooklet</link>
    <description>&lt;p&gt;Creating and printing a multi-page CD booklet can be a bit of a headache. Firstly, not all programs support the re-ordering of pages required to make a foldable double-sided booklet. Moreover, the page-size is non-standard, which may give difficulties with commandline-tools such as Ghostscript and psnup. It took me a while to figure out how to do this on Ubuntu (Jaunty). Here's how you can do it:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create the pages as you normally would, using a program of your choice (e.g. OpenOffice.org Writer, Scribus). Make sure you set the page-size of the document to 12.1 x 11.99 cm.&lt;/li&gt;
&lt;li&gt;Export the page to a PDF-file. Don't forget to embed fonts if needed.&lt;/li&gt;
&lt;li&gt;Make sure you have pdftops (from the package poppler-utils or xpdf-utils), pstops and psbook (from the package psutils) and ps2pdf (from the package gs) installed.&lt;/li&gt;
&lt;li&gt;Use the commands below to process your PDF-file:&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;pdftops input.pdf - | psbook | pstops "2:0@1(0,0)+1@1(12.1cm,0)" -w24.2cm -h11.99cm -d | ps2pdf -dDEVICEWIDTHPOINTS=686 -dDEVICEHEIGHTPOINTS=340 - cdbooklet.pdf&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Then print the resulting PDF-file on a printer capable of duplexing (i.e. double-sided printing, in which case you should set it to fold/bind on the short edge!). Or you can use a single-sided printer, and print even and odd pages on separate sides of the paper.&lt;/p&gt;
&lt;p&gt;If your printer only supports duplexing of portrait pages (folding/binding along the long edge of the page), you'll need to ajust the pstops pagespecs to print uneven pages upside-down. I haven't tested this yet, but it should be something like:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;pdftops input.pdf - | psbook | pstops "4:0@1(0,0)+1@1(12.1cm,0),4:3U@1(0,0)+2U@1(12.1cm,0)" -w24.2cm -h11.99cm -d | ps2pdf -dDEVICEWIDTHPOINTS=686 -dDEVICEHEIGHTPOINTS=340 - cdbooklet.pdf&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;To create the back-side of a jewel-case, you can use e.g. the Scribus template from this site: &lt;a href="http://www.feichelhardt.de/software/" title="http://www.feichelhardt.de/software/"&gt;http://www.feichelhardt.de/software/&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/lvzon/~4/1BWzDPE-TxM" height="1" width="1"/&gt;</description>
     <comments>http://levien.zonnetjes.net/?q=cdbooklet#comments</comments>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/1">article</category>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/5">howto</category>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/2">technical</category>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/7">ubuntu</category>
 <pubDate>Wed, 11 Nov 2009 01:25:36 +0000</pubDate>
 <dc:creator>levien</dc:creator>
 <guid isPermaLink="false">34 at http://levien.zonnetjes.net</guid>
  </item>
  <item>
    <title>Embedding fonts in PDF-files</title>
    <link>http://levien.zonnetjes.net/?q=pdf-fontembedding</link>
    <description>&lt;p&gt;A while back I wrote a course-reader in OpenOffice.org Writer on UbuntuWhen I submitted it for printing, it turned out that not all fonts were embedded in the document, which led to various printing- and layout-problems. Here's some advice on how to create PDFs that are suitable for printing by third parties.&lt;/p&gt;
&lt;h3&gt;OpenOffice.org&lt;/h3&gt;
&lt;p&gt;Make sure you use OpenOffice.org 3.x, export as PDF and try selecting select the option "PDF A/1". This should produce a &lt;a href="http://en.wikipedia.org/wiki/PDF/A"&gt;PDF/A compliant file&lt;/a&gt; which is suitable for archiving, and therefore has to have all fonts embedded. Also, for best printing-results the compression of images should be set to lossless.&lt;br /&gt;
There seem to be two problems with this method. First, PDF/A apparently does not support transparant objects. Unfortunately, instead of simply blending my embedded PNG-files with the background, the current OpenOffice.org PDF/A export seems to erraticly convert transparant areas to black. Moreover, in my current version of OpenOffice.org Writer (3.0.1) PDF A/1 export seems to produce invalid PDF-files (Adobe Reader 9 complains about an invalid colorspace). Luckily a "normal" PDF-export seems to work fine, and also seems to include all the fonts I need for printing... &lt;/p&gt;
&lt;h3&gt;Mac&lt;/h3&gt;
&lt;p&gt;MacOS X natively supports printing as PDF from within any application. When printing, select PDF and then Save as PDF-X. This will produce a &lt;a href="http://en.wikipedia.org/wiki/PDF/X"&gt;PDF/X compliant file&lt;/a&gt; which is suitable for device-independent printing, and therefore has to have all fonts embedded.&lt;/p&gt;
&lt;h3&gt;Windows&lt;/h3&gt;
&lt;p&gt;You can use the excellent and free &lt;a href="http://www.pdfforge.org/"&gt;PDFCreator&lt;/a&gt; to print as PDF from within any application. When printing, select PDFCreator as the printer. When printing, a dialog comes up that allows you to enter metadata (title, author, etc.). Click Options, then click Formats and select PDF. Select the Fonts tab, and make sure the "Embed all fonts" option is selected. For best printing-results, all image-compression-options should also be deselected in the Compression tab. Newer versions of PDFCreator also have an option for creating PDF/A compliant files. I haven't tested it though.&lt;/p&gt;
&lt;p&gt;If you use Adobe Acrobat (Distiller, PDF Writer or PDFMaker) to create PDFs, you can &lt;a href="http://www.acrobatusers.com/tutorials/2007/07/dusting_off_archives"&gt;select PDF/A compliance&lt;/a&gt; (in newer versions) or alternatively follow &lt;a href="http://blogs.adobe.com/acrolaw/2007/11/pdf-creation-and-font-embedding.html"&gt;this guide by Adobe&lt;/a&gt; or &lt;a href="http://www.planetpdf.com/mainpage.asp?WebPageID=362"&gt;this guide from Planet PDF&lt;/a&gt; to make sure all fonts are embedded.&lt;/p&gt;
&lt;h3&gt;Checking your PDF-file&lt;/h3&gt;
&lt;p&gt;As most people use Adobe Acrobat or &lt;a href="http://get.adobe.com/reader/otherversions/"&gt;Adobe Reader&lt;/a&gt; to print PDFs, it's always a good idea to open the file in Adobe Reader and check for layout-problems. On Ubuntu, you can install Adobe Reader from &lt;a href="http://www.medibuntu.org/"&gt;the Medibuntu repository&lt;/a&gt;. You can also see which fonts are embedded by clicking File &gt; Properties &gt; Document Properties &gt; Fonts. All fonts should have "Embedded" or "Embedded Subset" listed after the font name. In Ubuntu and other Linux-distros you can also use the &lt;code&gt;pdffonts&lt;/code&gt; command to list all fonts in a PDF-file. Embedded fonts have "yes" in the "emb" column.&lt;/p&gt;
&lt;h3&gt;Embedding fonts into an existing PDF-file&lt;/h3&gt;
&lt;p&gt;&lt;b&gt;In Ubuntu:&lt;/b&gt; Make sure you install all fonts that you want to embed. &lt;a href="http://levien.zonnetjes.net/?q=ubuntufonts"&gt;Here&lt;/a&gt; I have listed some tips for installing fonts in Ubuntu. You can use &lt;a href="http://pages.cs.wisc.edu/~ghost/"&gt;Ghostscript&lt;/a&gt; to create a new PDF-file that has all fonts embedded. The easiest way is to use Ghostscript's internal PDF-reader to convert the file:&lt;/p&gt;
&lt;pre&gt;gs -q -dNOPAUSE -dBATCH -dPDFSETTINGS=/prepress -sDEVICE=pdfwrite -sOutputFile=output.pdf input.pdf&lt;/pre&gt;&lt;p&gt;
This usually works fine, but Ghostscript's PDF parser is known to sometimes mess up graphics. To avoid this, you can first use the tool &lt;code&gt;pdftops&lt;/code&gt; that comes with Poppler/Xpdf (packages &lt;code&gt;poppler-utils&lt;/code&gt; and/or &lt;code&gt;xpdf-utils&lt;/code&gt;) to convert the PDF-file to PostScript:&lt;/p&gt;
&lt;pre&gt;pdftops input.pdf
gs -q -dNOPAUSE -dBATCH -dPDFSETTINGS=/prepress -sDEVICE=pdfwrite -sOutputFile=output.pdf input.ps&lt;/pre&gt;&lt;p&gt;
&lt;b&gt;In Windows:&lt;/b&gt; Make sure you have all fonts installed. If you have Adobe Acrobat, you can open the PDF file and use Tools &gt; Advanced Editing &gt; Touch Up Text Tool. Select the text that uses a non-embedded font, right-click and select Properties. Select the font you would like to embed and then save the document. With recent versions of Acrobat you can use the Preflight tool to convert PDFs to PDF/X or PDF/A compliant files (Options &gt; Convert Current PDF To PDF/X).&lt;/p&gt;
&lt;p&gt;If you don't have Adobe Acrobat, you can try &lt;a href="http://sourceforge.net/projects/ghostscript/files/"&gt;downloading a Windows-version of AFPL-Ghostscript&lt;/a&gt; and following the instructions for Ubuntu above.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;On MacOS X:&lt;/b&gt;Follow the instructions above, either with the Mac version of Adobe Acrobat, or with a recent version of Ghostscript for MacOS X. GPL Ghostscript versions (gplgs) for MacOS X can be found e.g. here: &lt;a href="http://www.openprinting.org/download/printdriver/macosx/" title="http://www.openprinting.org/download/printdriver/macosx/"&gt;http://www.openprinting.org/download/printdriver/macosx/&lt;/a&gt; Or you can try the older ESP version of Ghostscript: &lt;a href="http://gimp-print.sourceforge.net/MacOSX.php" title="http://gimp-print.sourceforge.net/MacOSX.php"&gt;http://gimp-print.sourceforge.net/MacOSX.php&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Extracting fonts from a PDF&lt;/h3&gt;
&lt;p&gt;This may occasionally be useful and can easily be done in Ubuntu using &lt;a href="http://fontforge.sourceforge.net/"&gt;Fontforge&lt;/a&gt;. Note that fonts in PDF-files (that are not PDF/A or PDF/X compliant) tend to be subsetted and therefore incomplete.&lt;br /&gt;
Follow this guide: &lt;a href="http://init.sh/?p=13" title="http://init.sh/?p=13"&gt;http://init.sh/?p=13&lt;/a&gt;&lt;br /&gt;
Or alternatively see this page for additional methods: &lt;a href="http://cg.scs.carleton.ca/~luc/pdfextract.html" title="http://cg.scs.carleton.ca/~luc/pdfextract.html"&gt;http://cg.scs.carleton.ca/~luc/pdfextract.html&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;References:&lt;/h3&gt;
&lt;p&gt;&lt;a href="http://www.sas.upenn.edu/computing/help/students/dissertation-pdf" title="http://www.sas.upenn.edu/computing/help/students/dissertation-pdf"&gt;http://www.sas.upenn.edu/computing/help/students/dissertation-pdf&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://zeppethefake.blogspot.com/2008/05/embedding-fonts-in-pdf-with-ghostscript.html" title="http://zeppethefake.blogspot.com/2008/05/embedding-fonts-in-pdf-with-ghostscript.html"&gt;http://zeppethefake.blogspot.com/2008/05/embedding-fonts-in-pdf-with-gho...&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=4338" title="http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=4338"&gt;http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=4338&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/lvzon/~4/55FXufctDE4" height="1" width="1"/&gt;</description>
     <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/1">article</category>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/5">howto</category>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/2">technical</category>
 <pubDate>Sat, 19 Sep 2009 15:49:00 +0000</pubDate>
 <dc:creator>levien</dc:creator>
 <guid isPermaLink="false">33 at http://levien.zonnetjes.net</guid>
  </item>
  <item>
    <title>Recompressing (optimising) PDF files</title>
    <link>http://levien.zonnetjes.net/?q=pdf-recompress</link>
    <description>&lt;p&gt;There are at least three ways to do this in Ubuntu. You will need the packages ghostscript (for all methods, but installed by default) and pdftk (for method 2), and optionally a Java Runtime Environment (for method 3).&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Method 1: ps2pdf&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The ps2pdf script that comes with Ghostscript is meant to convert PostScript to PDF, but it will happily take PDF-files as input. Just try: ps2pdf input.pdf output.pdf&lt;/p&gt;
&lt;p&gt;You can add GhostScript options to control the PDF-output. To get smaller files you can try adding one of the preset-options: &lt;code&gt;-dPDFSETTINGS=/ebook&lt;/code&gt; or &lt;code&gt;-dPDFSETTINGS=/screen&lt;/code&gt;&lt;br /&gt;
For more advanced settings: &lt;a href="http://pages.cs.wisc.edu/~ghost/doc/cvs/Ps2pdf.htm" title="http://pages.cs.wisc.edu/~ghost/doc/cvs/Ps2pdf.htm"&gt;http://pages.cs.wisc.edu/~ghost/doc/cvs/Ps2pdf.htm&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Note that the screen preset converts all images to sRGB and converts to PDF 1.3 which does not support all types of gradients and transparency. In some cases this may cause text to be converted into an image. Also, GhostScript does not seem to do a great job at converting CYMK colours to sRGB, so if your colours come out looking all weird after conversion your original document probably used CYMK colours. In such cases I first convert to a PDF-file with device-independent colours (where possible, and otherwise they should be kept as CYMK), and then run a second pass in which I compress the file but keep it as PDF 1.4 (or a higher version, which you should specify with a switch such as &lt;code&gt;-dCompatibilityLevel=1.5&lt;/code&gt;):&lt;/p&gt;
&lt;p&gt;&lt;code&gt;ps2pdf -dColorConversionStrategy=/UseDeviceIndependentColor -dUseCIEColor input.pdf input-ciecolor.pdf&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;ps2pdf -dColorConversionStrategy=/UseDeviceIndependentColor -dUseCIEColor -dColorImageDownsampleType=/Bicubic -dColorImageResolution=72 -dGrayImageResolution=72 -dMonoImageResolution=300 -dDownsampleColorImages=true -dDownsampleGrayImages=true -dDownsampleMonoImages=true -dOptimize=true -dProcessColorModel=/DeviceCMYK input-ciecolor.pdf output-screen.pdf&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;At least this shouldn't make things worse with regard to colour, and it also retains your text as text.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Method 2: The compress-newsletter script&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The above methods works well, but you will probably lose any metadata in the document, including bookmarks, author information, etc.&lt;/p&gt;
&lt;p&gt;If you need to keep metadata, you can try the following perl-script. It was especially written to recompress Scribus PDF output without losing metadata:&lt;br /&gt;
&lt;a href="http://www.capca.ucalgary.ca/~wdobler/utils/compress-newsletter.html" title="http://www.capca.ucalgary.ca/~wdobler/utils/compress-newsletter.html"&gt;http://www.capca.ucalgary.ca/~wdobler/utils/compress-newsletter.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Method 3: Multivalent&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;A Java-based browser and toolbox for digital documents: &lt;a href="http://multivalent.sourceforge.net/" title="http://multivalent.sourceforge.net/"&gt;http://multivalent.sourceforge.net/&lt;/a&gt;&lt;br /&gt;
You'll need to download the jar-file. It has a recompression class that you can run from the commandline. For example:&lt;br /&gt;
&lt;code&gt;CLASSPATH=":/usr/local/lib/Multivalent20060102.jar" java tool.pdf.Compress -jpeg input.pdf&lt;/code&gt;&lt;br /&gt;
(This assumes of course that you've copied the jar-file to /usr/local/lib first, e.g. &lt;code&gt;sudo mv ~/Desktop/Multivalent20060102.jar /usr/local/lib&lt;/code&gt;)&lt;/p&gt;
&lt;p&gt;This method is easy, but may or may not work well depending on the input file so be sure to always check your output!&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/lvzon/~4/b9O8cEex5Hs" height="1" width="1"/&gt;</description>
     <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/1">article</category>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/2">technical</category>
 <pubDate>Mon, 17 Aug 2009 17:22:28 +0000</pubDate>
 <dc:creator>levien</dc:creator>
 <guid isPermaLink="false">32 at http://levien.zonnetjes.net</guid>
  </item>
  <item>
    <title>Batch search &amp; replace in PDF files</title>
    <link>http://levien.zonnetjes.net/?q=replacepdftext</link>
    <description>&lt;p&gt;The other day I found out I had misspelled a word in a whole batch of automatically generated PDF files. Regenerating all of them would be a lot of work, as the PDF files were plots created using &lt;a href="http://levien.zonnetjes.net/?q=pdl"&gt;perl/PDL&lt;/a&gt;, &lt;a href="http://www.gnuplot.info/"&gt;gnuplot&lt;/a&gt; and &lt;a href="http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id=epstopdf"&gt;epstopdf&lt;/a&gt; (available in &lt;code&gt;texlive-extra-utils&lt;/code&gt;), and the input data was scattered over about 20 different machines. Of course I could have hand-edited all the files using &lt;a href="http://www.inkscape.org/"&gt;Inkscape&lt;/a&gt;, but that would also be a lot of work. Instead, I discovered there's an easy way to automatically search &amp;amp; replace text strings in PDF files on my Linux system, using &lt;a href="http://www.grymoire.com/Unix/Sed.html"&gt;sed&lt;/a&gt; and &lt;a href="http://www.accesspdf.com/pdftk/"&gt;pdftk&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;First, make sure you have pdftk installed. On Ubuntu you can simply do: &lt;code&gt;sudo apt-get install pdftk&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Then, use a &lt;a href="/files/replacepdftext.sh"&gt;shell-script&lt;/a&gt; to uncompress the PDF-files, replace the text and recompress them again. For instance:&lt;/p&gt;
&lt;pre&gt;

#!/bin/bash

oldtext=$1
newtext=$2
pdffile=$3

cp $pdffile $pdffile.bak
pdftk $pdffile output $pdffile.tmp uncompress
sed -i "s/$oldtext/$newtext/g" $pdffile.tmp
pdftk $pdffile.tmp output $pdffile compress

&lt;/pre&gt;&lt;p&gt;
You can easily modify this to run on a whole batch of files. Actually, I just made this as a quick hack, and executed the script using something like:&lt;/p&gt;
&lt;pre&gt;
for i in *.pdf ; do replacepdftext.sh oldword newword $i ; done
&lt;/pre&gt;&lt;p&gt;But I'm sure there's a better way to integrate batch processing in the script itself...&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/lvzon/~4/no898s4QBNQ" height="1" width="1"/&gt;</description>
     <comments>http://levien.zonnetjes.net/?q=replacepdftext#comments</comments>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/1">article</category>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/10">linux</category>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/2">technical</category>
 <pubDate>Tue, 19 May 2009 12:51:23 +0000</pubDate>
 <dc:creator>levien</dc:creator>
 <guid isPermaLink="false">30 at http://levien.zonnetjes.net</guid>
  </item>
  <item>
    <title>Installing and using fonts in Ubuntu</title>
    <link>http://levien.zonnetjes.net/?q=ubuntufonts</link>
    <description>&lt;p&gt;One of the drawbacks of Ubuntu (and Gnome in general) is that it hasn't got a decent font-manager yet. Moreover, since Gnome upgraded to the new gvfs (as of Ubuntu 8.04), the font viewer and manager that was available in previous versions (which could be reached by browsing font:/// in the file-manager) stopped working as well. This will undoubtedly be fixed in newer Gnome versions of course, but for now this leaves users of Hardy Heron and Intrepid Ibex without proper font management, which is kind of annoying.&lt;/p&gt;
&lt;p&gt;Luckily this problem is mostly superficial. Despite the current lack of a nice GUI, it's really not that hard to install fonts in Ubuntu. All the hard work is handled behind the scenes by &lt;a href="http://mintaka.sdsu.edu/GF/bibliog/latex/debian/defoma.html"&gt;Defoma&lt;/a&gt;, the somewhat invisible Debian Font Manager. &lt;/p&gt;
&lt;p&gt;Of course Ubuntu comes with lots of free typefaces, many of which are quite good. And you can get the usual boring Windows fonts (Arial, Times New Roman, etc.) by installing the &lt;code&gt;msttcorefonts&lt;/code&gt; package. But quite often you do really need to install additional typefaces (PostScript Type 1, TrueType or OpenType) to get some work done. &lt;/p&gt;
&lt;p&gt;If you only have one user on your system, the easiest way to install fonts is by using the &lt;b&gt;.font&lt;/b&gt; folder in your home directory. Simply create one (and if you're using the file manager, don't forget to switch on View-&amp;gt;Show Hidden Files, or you won't see the folder) and copy the font files there. To make Defoma aware of your new fonts, run &lt;code&gt;fc-cache -f -v&lt;/code&gt; in a terminal. This will update the font-cache, so you're ready to go.&lt;/p&gt;
&lt;p&gt;I usually prefer to install fonts system-wide, so all users can see them. To keep my custom fonts separated from the standard Ubuntu ones, I create directories in /usr/local/share/fonts and copy the font files there. Note that you need to be root to do that, so you must either do it using a file-manager instance with root privileges (&lt;code&gt;gksu nautilus&lt;/code&gt;), or by changing the ownership of the fonts directory using &lt;code&gt;sudo chown insert-username-here /usr/local/share/fonts&lt;/code&gt;. I find the latter option to be somewhat safer and more practical. :-) After you're done, don't forget to update the font-cache again using &lt;code&gt;fc-cache -f -v&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Oddly, also the Gnome font-viewer &lt;code&gt;gfontview&lt;/code&gt; isn't available in the repositories for Ubuntu 8.04 and 8.10. For previewing fonts that aren't installed, I currently use the &lt;code&gt;fontforge&lt;/code&gt; font editor. For viewing installed fonts you can use &lt;code&gt;gnome-specimen&lt;/code&gt;. You can install both through &lt;code&gt;apt-get&lt;/code&gt; or Synaptic.&lt;/p&gt;
&lt;p&gt;Unfortunately the current Linux version of OpenOffice has its own font rendering subsystem, which still does not support OpenType fonts. Hopefully these will be supported in OpenOffice.org 3.2. The status of this feature is tracked &lt;a href="http://eis.services.openoffice.org/EIS2/cws.ShowCWS?Path=DEV300%2Fotf01"&gt;as otf01 in the Sun EIS&lt;/a&gt; and &lt;a href="http://qa.openoffice.org/issues/show_bug.cgi?id=43029"&gt;Issue #43029 in OOo QA&lt;/a&gt;. Other applications such as Abiword, Koffice, Scribus, Inkscape and The Gimp should work just fine with OpenType fonts. &lt;/p&gt;
&lt;p&gt;Interestingly, LaTeX (or rather &lt;a href="http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&amp;amp;id=xetex"&gt;XeLaTeX&lt;/a&gt;) can also use OpenType fonts without problems. Just install the package &lt;code&gt;texlive-xetex&lt;/code&gt;. Now if I want use one of my favourite fonts (Futura Book), all I need to do is include the commands &lt;code&gt;\usepackage{fontspec}&lt;/code&gt; and &lt;code&gt;\setromanfont{Futura Std Book}&lt;/code&gt; (note that the font name is case sensitive!) in my .tex file, and run it through &lt;code&gt;xelatex&lt;/code&gt; instead of the usual &lt;code&gt;pdflatex&lt;/code&gt;. Read &lt;a href="http://existentialtype.net/2008/07/12/fonts-in-latex-part-one-xelatex/"&gt;this guide&lt;/a&gt; for more information. If you really do need pdflatex, that's also possible but things become somewhat more complicated, &lt;a href="http://existentialtype.net/2008/07/12/fonts-in-latex-part-two-pdftex-and-opentype/"&gt;as is explained here for PostScript OpenType&lt;/a&gt; and &lt;a href="http://existentialtype.net/2008/07/19/fonts-in-latex-part-three-pdftex-and-truetype/"&gt;here for TrueType&lt;/a&gt;. Unfortunately the wonderful LaTeX editor &lt;a href="http://kile.sourceforge.net/"&gt;Kile&lt;/a&gt; &lt;a href="http://bugs.kde.org/show_bug.cgi?id=156993"&gt;does not yet support XeLaTeX out-of-the-box&lt;/a&gt;, but this is easily fixed for now by &lt;a href="http://www.tug.org/pipermail/xetex/2008-March/thread.html#9120"&gt;adding a tool&lt;/a&gt; and &lt;a href="http://sourceforge.net/forum/message.php?msg_id=5254409"&gt;altering the QuickPreview settings&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Finally, a word about the default screen-rendering of user-interface fonts in Ubuntu. Perhaps I'm old-fashioned, but I prefer to turn off antialiasing for small font sizes, mostly because the "fuzz" introduced by antialiasing also makes my head go fuzzy. ;-) If you agree, visit &lt;a href="http://www.sharpfonts.com/" title="http://www.sharpfonts.com/"&gt;http://www.sharpfonts.com/&lt;/a&gt; and follow the instructions. On this site you can also download the &lt;a href="http://www.sharpfonts.com/fonts/tahoma32.exe"&gt;MS Tahoma font&lt;/a&gt;, which is the one Windows uses (or used up to XP) for its user-interface. Although that in itself is definitely not a good reason for using it, it does render superbly without antialiasing. For that reason I usually set an 8-point Tahoma as application font, desktop font and window title font in System-&amp;gt;Preferences-&amp;gt;Appearance-&amp;gt;Fonts.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/lvzon/~4/5rI9foOomvY" height="1" width="1"/&gt;</description>
     <comments>http://levien.zonnetjes.net/?q=ubuntufonts#comments</comments>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/1">article</category>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/2">technical</category>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/7">ubuntu</category>
 <pubDate>Sun, 25 Jan 2009 17:34:41 +0000</pubDate>
 <dc:creator>levien</dc:creator>
 <guid isPermaLink="false">29 at http://levien.zonnetjes.net</guid>
  </item>
  <item>
    <title>Video Encoding Tips</title>
    <link>http://levien.zonnetjes.net/?q=encodevideo</link>
    <description>&lt;p&gt;For a couple of years there have been a number of great open-source programs around for encoding video, both in Windows and (Ubuntu) Linux. Some of them provide a nice graphical user interface, but the best ones are still commandline tools, such as &lt;a href="http://www.ffmpeg.org/documentation.html"&gt;ffmpeg&lt;/a&gt; and &lt;a href="http://www.mplayerhq.hu/design7/info.html#docs"&gt;MEncoder&lt;/a&gt;. They are extremely flexible, but unfortunately also have a bewildering number of commandline options. This page lists a few invocations I regularly use.&lt;/p&gt;
&lt;h3&gt;Encoding PAL DV to MPEG-4 video&lt;/h3&gt;
&lt;p&gt;I use Kino to capture DV video from my camcorder over FireWire. As I have a rather cheap camcorder, the result tends to be somewhat noisy. I compress it using MEncoder, and I usually set it co constant quality (vqscale=4, use a value of 3 or 2 for better quality), switch on noise reduction (nr=600) and some high-quality options (mbd=2:trell=yes:v4mv=yes), and I apply a deinterlacing filter to the source (-vf-add kerndeint). I force the fourcc identifier to MP4V, because not all players recognise the default FMP4 identifier. Also, you have to explicitly provide the aspect ratio (4:3 for PAL) for it to be stored in the AVI output header.&lt;/p&gt;
&lt;pre&gt;
mencoder -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell=yes:v4mv=yes:nr=600:vqscale=4:aspect=4/3 \
-oac mp3lame -lameopts vbr=3 \
-vf-add kerndeint -ffourcc MP4V \ 
-o mpeg4-output.avi dv-input.avi

&lt;/pre&gt;&lt;p&gt;
Kino usually splits the DV stream into multiple files, so after compression I join them together again using:&lt;/p&gt;
&lt;pre&gt;
mencoder -oac copy -ovc copy -of avi -force-avi-aspect 4/3 -o merged-output.avi fragment1.avi fragment2.avi fragment3.avi

&lt;/pre&gt;&lt;p&gt;
Note that of course you can already join multiple fragments during the encoding step. Also, use of variable bitrate (VBR or ABR) in the MP3 audio stream may sometimes cause your audio and video to go out of sync. To prevent that you can use something like &lt;code&gt;-lameopts cbr:br=160:mode=0&lt;/code&gt; to force stereo audio with a constant bitrate (128, 160 or 192 kbps should be fine) instead of a variable one.&lt;/p&gt;
&lt;p&gt;To get a smaller file, you could consider using either multipass encoding or encoding with a more advanced codec such as H.264. For multipass encoding, leave out the vqscale option and  run mencoder several times, providing the options vpass=1:turbo, vpass=2, etc. for each pass.&lt;/p&gt;
&lt;p&gt;To encode as an H.264 AVI file with AAC audio, you should be able to use something like:&lt;/p&gt;
&lt;pre&gt;
mencoder -ovc x264 -x264encopts threads=auto:subq=5:8x8dct:frameref=2:bframes=3:b_pyramid:weight_b:crf=24 \
-force-avi-aspect 4/3 -vf hqdn3d,kerndeint,scale -oac faac \
-o output-h264.avi input-dv.avi

&lt;/pre&gt;&lt;p&gt;
Increase the crf value to get a smaller file, or decrease it for higher quality. It's probably a good idea to convert the AVI file to an IsoMedia (MPEG-4 part 14) stream afterwards, e.g. using MP4Box from the Ubuntu gpac package.:&lt;/p&gt;
&lt;pre&gt;
mplayer -dumpvideo -dumpfile output-h264.h264 output-h264.avi
mplayer -dumpaudio -dumpfile output-h264.aac output-h264.avi
MP4Box -add output-h264.avi -new output-h264.mp4

&lt;/pre&gt;&lt;p&gt;
Unfortunately MP4Box complains about the video stream (Cannot find H264 start code), I'm not sure why.&lt;/p&gt;
&lt;p&gt;If it does work, the result should play fine using something like MPlayer or VLC, but unfortunately not with Quicktime 7. To make the file playable by Quicktime 7, reduce the encoding options in the mplayer commandline to:&lt;/p&gt;
&lt;pre&gt;
-x264encopts threads=auto:subq=5:frameref=2:crf=24

&lt;/pre&gt;&lt;h3&gt;See also&lt;/h3&gt;
&lt;li&gt;&lt;a href="http://www.mplayerhq.hu/DOCS/HTML/en/encoding-guide.html"&gt;The MPlayer encoding guide&lt;/a&gt;&lt;/li&gt;&lt;img src="http://feeds.feedburner.com/~r/lvzon/~4/L0mmiehLols" height="1" width="1"/&gt;</description>
     <comments>http://levien.zonnetjes.net/?q=encodevideo#comments</comments>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/1">article</category>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/5">howto</category>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/8">tchnical</category>
 <category domain="http://levien.zonnetjes.net/?q=taxonomy/term/9">video</category>
 <pubDate>Thu, 04 Dec 2008 16:58:03 +0000</pubDate>
 <dc:creator>levien</dc:creator>
 <guid isPermaLink="false">28 at http://levien.zonnetjes.net</guid>
  </item>
  </channel>
</rss>
