Scroll to navigation

UNIHEXROTATE(1) General Commands Manual UNIHEXROTATE(1)


unihexrotate - rotate Unifont hex glyphs in quarter turn increments


unihexrotate [-n quarter-turns] [input-font.hex] > output-font.hex


unihexrotate reads a GNU Unifont .hex format file named on the command line, or from stdin if no filename is given. If a number of quarter turns is specified, it rotates each glyph clockwise by that number of quarter turns, or counterclockwise if the number is negative. The resulting modified .hex file is written to stdout. The format of a .hex file is described in the unifont(5) man page.

If the number of quarter turns is not specified, unihexrotate will rotate each glyph by a default value of one quarter turn (i.e., 90 degrees) clockwise.

unihexrotate only supports Unifont .hex files with glyphs that are 8 columns and 16 columns wide. If an 8-column glyph is rotated, it is first centered within a 16-column glyph so the rotation will be performed on a 16-by-16 pixel glyph. One additional use of this program is that a glyph can be converted from 8 columns wide to 16 columns wide by specifying a rotation of 0 quarter turns.


Specify an integer number of quarter turn clockwise rotations to perform, typically as "-n 0" through "-n 3" (alternatively as "-n=0" through "-n=3") for rotations of 0, 90, 180, or 270 degrees, respectively. Negative values will perform counterclockwise rotations by the specified number of quarter turns.


This example extracts the Mongolian glyphs in the "unifont-base.hex" file (located in the "font/plane00" directory) and pipes them to unihexrotate to rotate by the default amount of one quarter turn clockwise (i.e., by 90 degrees). The basic Mongolian glyphs are in the Unicode range U+1800 through U+18AF. The original glyphs in "unifont-base.hex" are drawn for horizontal rendering (as per the Unicode Standard). The output rotated glyphs are suitable for rendering Mongolian in its traditional vertical form. Because no filename is specified to unihexrotate in this example, its input is taken from stdin.

grep "^18[0-A]" unifont-base.hex | unihexrotate > vertical.hex

The next example reverses the rotation performed above, by one quarter turn counterclockwise. In this example, the input filename "vertical.hex" is specified.

unihexrotate -n -1 vertical.hex > horizontal.hex


Unifont .hex format input and output files.


bdfimplode(1), hex2bdf(1), hex2otf(1), hex2sfd(1), hexbraille(1), hexdraw(1), hexkinya(1), hexmerge(1), johab2syllables(1), johab2ucs2(1), unibdf2hex(1), unibmp2hex(1), unibmpbump(1), unicoverage(1), unidup(1), unifont(5), unifont-johab631(5), unifont-viewer(1), unifont1per(1), unifontchojung(1), unifontksx(1), unifontpic(1), unigen-hangul(1), unigencircles(1), unigenwidth(1), unihex2bmp(1), unihex2png(1), unihexfill(1), unihexgen(1), unihexpose(1), unijohab2html(1), unipagecount(1), unipng2hex(1)


unihexrotate was written by David Corbett.


unihexrotate is Copyright © 2019 David Corbett.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.


No known bugs exist.

2019 Feb 23