July 2008 Archives

xfig problems

| | Comments (0) | TrackBacks (0)

This week I needed xfig to edit some figures, however my font path wasn’t set up correctly on gentoo, at least for xfig, and I got the following message (despite of ugly tiny default fonts):

File /home/ritschi/thesis/graphics/mrfilt.fig:
Can’t find --helvetica-medium-r-narrow—13------ISO8859-, using 6x13
Can’t find -
-helvetica-medium-r-narrow—10------ISO8859-, using 6x13

In order to get the fonts working, I had to add the following line to my xorg config (/etc/X11/xorg.conf ) and to restart X:

FontPath “/usr/share/fonts/default/ghostscript”

Installing xfig on my MacBook from MacPorts yielded first the following warning:

Either you have a very old app-defaults file installed (Fig), or there is none installed at all. You should install the correct version or you may lose some features. This may be done with “make install” in the xfig source directory.

This is because MacPorts mixes the paths and X11 uses /usr/X11/lib/X11/app-defaults, while MacPorts installs the files in /opt/local/lib/X11/app-defaults. Just copy the files to the X11 folder and the warning will go away. Anyway in order to get rid of the first message, the font path for X11 has to be corrected. Till now I haven’t found a way to do this permanently, so I have to do it every time currently:

cd /usr/X11/lib/X11/fonts
ln -sf /opt/local/share/ghostscript/fonts/ ghostscript
fc-cache ghostscript
xset fp+ /usr/X11/lib/X11/fonts/ghostscript
xset fp rehash
xfig

Yesterday I updated my boot system, which I use to boot my system from an USB flash drive. It’s consists basically of BusyBox, the swiss army knife of embedded Linux and uClibc, a small c library for embedded systems plus some more tools, which I need to setup Raid and to decrypt my devices before switching to my main system. Here are the steps needed to build the system based on a stage3 snapshot of gentoo sources:

First get the snapshot, unpack it and update it:

wget http://de-mirror.org/distro/gentoo/experimental/x86/embedded/stages/stage3-x86-uclibc-2008.0.tar.bz2
tar xvfz stage3-x86-uclibc-2008.0.tar.bz2 -C bootsystem/
mount -t proc proc /boot/boot
system/proc
cp -L /etc/resolv.conf /boot/bootsystem/etc/
chroot /boot/boot
system /bin/bash
env-update && source /etc/profile
emerge sync
emerge -auDv world

after that make a directory for your boot system and emerge all required packages:

mkdir /bootimage
ROOT=/boot
image USE=”static make-symlinks” emerge -av busybox mdadm
ROOT=/boot_image USE=”static” emerge -av =gnupg-1.4.9 cryptsetup

create the config for mdadm:

/sbin/mdadm —detail —scan >> /boot_image/etc/mdadm.conf

Having the system set up, we still need to build an initrd or initramfs, which can be both loaded at boot time. I choose the latter one and you have just to tell the kernel where your boot system resides. This is done by setting the CONFIGINITRAMFSSOURCE in the kernel config. Mine looks like this:

CONFIGINITRAMFSSOURCE=”/boot/bootimage /boot/cpiolist”

/boot/bootimage is the system create above and /boot/cpiolist contains some nodes required at bootup (early userspace), which are not created by busybox:

# supporting directories
dir /proc 0755 0 0
dir /sys 0755 0 0
dir /root 0755 0 0
dir /dev 0755 0 0
#initial device files required (mdev creates the rest)
nod /dev/console 0600 0 0 c 5 1
nod /dev/null 0666 0 0 c 1 3

HowTo convert jpg to pdf

| | Comments (0) | TrackBacks (0)

Recently I had to convert some scans to pdf. Unfortunately the scaned documents were only available as jpg, so I was looking for a way to convert these (huge) images into one pdf. First I thought ok, let’s use convert (which is part of ImageMagick, however it turned out that the output pdf got either bloated (700kbyte -> 11Mbyte!!!) or had poor quality when the images where previously scaled down.

After trying heaps of tools with unsatisfying results, I finally found a package called leptonica-progs, which provides a tool called converttops to convert images directly into ps files while preserving good quality and holding down the file size.

Install leptonica-progs:

aptitude install leptonica-progs

preprocess images to reduce filesize:

convert input.jpg - resize 50% output.jpg

convert jpg to ps:

/usr/bin/leptonica/converttops input.jpg output.ps

convert ps to pdf:

ps2pdf *ps

join the pdf files into a single one:

pdfjoin *pdf

About this Archive

This page is an archive of entries from July 2008 listed from newest to oldest.

May 2008 is the previous archive.

August 2008 is the next archive.

Find recent content on the main index or look in the archives to find all content.