Kategoriler
Anlatım Genel Linux

Embed and Subset Fonts

Assalamu alaikum (Peace be upon you) dear visitor,

I have faced with font embed and subset problem every time I submit my research paper to IEEE or ACM conference or journal. In this article, I am going to explain how I embed and subset fonts in Ubuntu 14.04.1 LTS 64 bit. Here is my solution:

  1. Open terminal.
  2. Update repository.
  3. Install texlive.
  4. Install texlive-publishers.
  5. Install ghostscript.
  6. Create a shell script (sh) file in the folder that has your (IEEE, ACM) tex file.
  7. Copy the code below and paste it to the shell script file.
  8. Grant the execution permission and run it!

Congratulations! Now you have a pdf with embeded subset fonts.

Assalamu alaikum (Peace be upon you) 🙂

#!/bin/bash

## do not write tex extension
## only write tex file name
TEX_FILENAME=””
## do not write bib extension
## only write bib file name
BIB_FILENAME=””

if [ $# == 1 ]; then
TEX_FILENAME=$1
BIB_FILENAME=$1
elif [ $# == 2 ]; then
TEX_FILENAME=$1
BIB_FILENAME=$2
else
echo “This script requires two parameters to generate pdf with embeded subset fonts. These are tex and bib filenames.”
echo “You must provide at least one argument. In this case, script assumes that tex and bib file has exactly the same name.”
echo “Otherwise, first one must be tex file name without extension and the second one must be bib file name without extension.”
echo “Example: shellScript.sh myTexFile myBibFile”
echo “Wrong: shellScript.sh myBibFile.bib myTexFile.tex”
echo “Wrong: shellScript.sh myBibFile myTexFile.tex”
echo “Wrong: shellScript.sh myBibFile.bib myTexFile”
echo “Wrong: shellScript.sh myTexFile.tex myBibFile”
echo “Wrong: shellScript.sh myTexFile myBibFile.bib”
echo “Wrong: shellScript.sh myTexFile.tex myBibFile.bib”

exit 1
fi

## globals
LATEX_EXTENSION=”.tex”
BIBTEX_EXTENSION=”.bib”
DVI_EXTENSION=”.dvi”
PS_EXTENSION=”.ps”
PDF_EXTENSION=”.pdf”
AUX_EXTENSION=”.aux”
BBL_EXTENSION=”.bbl”
BLG_EXTENSION=”.blg”
LOG_EXTENSION=”.log”
SYNCTEX_EXTENSION=”.synctex”
GZ_EXTENSION=”.gz”

## create DVI file and update references
latex $TEX_FILENAME
bibtex $BIB_FILENAME
latex $TEX_FILENAME
latex $TEX_FILENAME

## convert DVI to PS
#dvips -Ppdf -G0 -ta4
dvips -Ppdf -G0 -ta4 $TEX_FILENAME

## convert PS to PDF
## in the mean time embed font subsets
ps2pdf -dCompatibilityLevel#1.4 \
-dPDFSETTINGS#/prepress \
-dAutoRotatePages#/None \
-dCompressPages#true \
-dASCII85EncodePages#false \
-dUseFlateCompression#true \
-dEmbedAllFonts#true \
-dSubsetFonts#true \
-dMaxSubsetPct#100 \
-dConvertCMYKImagesToRGB#false \
-dAutoFilterColorImages#true \
-dColorImageFilter#/DCTEncode \
-dEncodeColorImages#true \
-dDownsampleColorImages#true \
-dColorImageDepth#-1 \
-dColorImageResolution#300 \
-dColorImageDownsampleThreshold#1 \
-dColorImageDownsampleType#/Bicubic \
-dAutoFilterGrayImages#true \
-dGrayImageFilter#/DCTEncode \
-dEncodeGrayImages#true \
-dDownsampleGrayImages#true \
-dGrayImageDownsampleThreshold#1 \
-dGrayImageDownsampleType#/Bicubic \
-dGrayImageDepth#-1 \
-dGrayImageResolution#300 \
-dMonoImageFilter#/CCITTFaxEncode \
-dEncodeMonoImages#true \
-dDownsampleMonoImages#true \
-dMonoImageDownsampleThreshold#1 \
-dMonoImageDownsampleType#/Bicubic \
-dMonoImageDepth#-1 \
-dMonoImageResolution#600 \
“$TEX_FILENAME$PS_EXTENSION” “$TEX_FILENAME$PDF_EXTENSION”

## remove unnecessary files automatically
rm $TEX_FILENAME$AUX_EXTENSION
rm $TEX_FILENAME$DVI_EXTENSION
rm $TEX_FILENAME$PS_EXTENSION
rm $TEX_FILENAME$BBL_EXTENSION
rm $TEX_FILENAME$BLG_EXTENSION
rm $TEX_FILENAME$LOG_EXTENSION

Kategoriler
Anlatım Software Defined Networking

Floodlight Unknown Host Discovery

Assalamu alaikum wa rahmatulllahi wa barakatuh.
(Peace be upon you dear visitor.)

In my tests, I saw that Floodlight discovers an unknown host per switch as in the figure below.

fl_unknown_host_discovery

I have Floodlight (FL), Mininet (MN) and Open VSwitch (OVS) installed in the same machine where Ubuntu 14.04 LTS x64 is running. As far as I know, OVS 2.0.1 supports kernel from 2.6.32 to 3.10. Since my Ubuntu kernel is 3.13, this may be the source of problem. Update of OVS or downgrade of Ubuntu kernel may solve the problem but I have another simple, not that good, solution.

With the help and advise of Hung-Wei Chiu from Floodlight-Developers group, I noticed that there are many IPv6 packets in the FL logs as he had told. This unknown IPv6 addresses were the same as MAC addresses of switches or hosts. As a solution to this problem, I disabled IPv6 in my computer.

In order to disable IPv6, you must append the three lines of code as in below to the file located in /etc/sysctl.conf . Note that you need root privileges.

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

After modification, you can either reboot your computer or execute sudo sysctl -p command in terminal.

However, this method may not work as expected. (Well, it did not work for me) Alternatively, there is another way of disabling IPv6 in Linux. Using your favorite text editor, open /etc/default/grub file. Then, add ipv6.disable=1 to the GRUB_CMDLINE_LINUX line. In my computer (Ubuntu 14.04 LTS x64), it was like:

GRUB_CMDLINE_LINUX=""

After change:

GRUB_CMDLINE_LINUX="ipv6.disable=1"

After this modification, you must update grub with executing the command sudo update-grub . Finally, reboot your computer and problem solved!

Assalamu alaikum wa rahmatulllahi wa barakatuh.