Articles with tag “entwicklung” (page 1 of 1):

Now you can easily generate your own TTF versions of the Terminus font

On in “Devstuff” by Tblue3 comments
Last updated: Sat, 12 June 2021 22:08 CEST
Tags: , , ,

More than 6 months ago, I wrote about generating TTF versions of the Terminus font (and published mine on that occasion), but I didn’t actually explain how to generate them.

I found the answer to my problem (“How do I get TTF files from the Terminus BDF source files?”) in the FontForge FAQ:

  • Create a new font.
  • Import the different sizes (one BDF file per font size). Make sure to import the BDF file with the biggest bitmaps into the glyph background!
  • Select all glyphs.
  • Autotrace them.
  • Add extrema.
  • Simplify all glyphs.
  • Save as TTF.

This process requires the AutoTrace program and FontForge, obviously. While repeating these steps at least two times (for the medium and bold versions of Terminus) is not that hard, I really like to automate things. I also wanted an italic version (I accomplished that by running the BDF files through mkitalic).

Fortunately, FontForge is scriptable! This allowed me to write a script in FontForge’s own “legacy” scripting language (the build I used didn’t support Python scripts…) to perform the steps described above, a small wrapper for AutoTrace to remove the obnoxious borders it adds to the resulting Postscript “images” and a small shell script wrapper that runs mkitalic to produce italic BDF files, tells FontForge to use my AutoTrace wrapper and finally runs the FontForge script for the three different font weights (medium, bold and italic).

Since I had to do some research to obtain the above information, I thought it would be nice to allow other people to easily generate TTF versions of Terminus (mind you, I might lose interest some day!). The scripts I wrote were only tested on unixoid systems (I didn’t test whether they correctly run on Windows, e. g. using Cygwin or CoLinux; they probably do, though).

Get the scripts here: https://github.com/Tblue/mkttf/archive/master.zip.

Also check out my Git repository on GitHub.

Read the included README file for information on how to use the mkttf.sh script. Feel free to post comments (questions, constructive criticism…)!

You might want to use these scripts to generate TTF versions of other fonts than Terminus, too; since the scripts are all fairly generic, it should be sufficient to modify mkttf.sh.

Have fun!

Generating up-to-date TTF files for the Terminus font

On in “Devstuff” by Tblue7 comments
Tags: , , ,

Note

Look here for the most recent version of Terminus (TTF)!

My favourite monospaced programming font is Terminus — I use it on each of my two machines.

The downloadable tarball contains scripts to generate versions of the font which can be read e. g. by the X server or used with a Linux TTY. That works wonderfully.

My old favourite text editor (Geany) used fontconfig to manage fonts, so I didn’t have to to change anything to make Terminus work with it. But recently I switched to a more feature-rich IDE: Netbeans. Since Netbeans is a Java application, it cannot use the font files which the X server (and fontconfig) can read but instead needs TTF files.

Luckily, there is a TTF version of Terminus available on the web. It works with Java (and Netbeans, too), but that’s where my problems began: Firstly, the font seems to miss the €uro symbol and secondly, it uses slanted single quotes, which simply look ugly to me (too much like backticks). It also seems to be based on an extremely old release of the Terminus font (dated back to 2004; that wouldn’t even bother me that much if it would work flawlessly).

So what’s the solution? I figured out how to generate my own TTF version of Terminus (even with outlines!) which fixes all my problems I mentioned above. It isn’t perfect (well, the outlines aren’t), but it works. Better than nothing, right?

Since I am such a generous person (ahem), I decided to make the files available to the public. You can get them at http://files.ax86.net/terminus-ttf; please read the README.txt file for licensing information.

To make your JRE aware of the fonts, copy them to its font directory (/opt/java/jre/lib/fonts on Arch Linux).

Some closing and/or useful remarks:

  • According to commentator Infinality:

    [The fonts] must be rendered in monochrome B/W. If you render them in grayscale or subpixel they will be smeary.

    Thanks for the hint!

  • The “ge1” patch has been applied to the BDF source files.

  • Beware of the italic version: It’s extremely ugly (it has been generated automatically by mkitalic).

  • I only tested the fonts on Linux and with Sun’s JRE. That means I didn’t test how the font outlines look (as I said above, some of them are not totally equal to the bitmaps), since Java uses the embedded bitmaps (which should be fine, since I didn’t alter them).

  • Tools I used to generate the fonts: FontForge, AutoTrace.

  • For more information on how I actually generated the TTF files, read Now you can easily generate your own TTF versions of the Terminus font.

  • Happy coding!

b2evolution (nun endgültig) komplett auf Deutsch

On in “Übersetzungen” by Tblue1 comment
Tags: , , , ,

Seit einigen Tagen ist die deutsche Übersetzung von b2evolution abgeschlossen (momentane Phase: Ausbügeln von Tippfehlern etc.) und ist bei Launchpad einsehbar.

Wer b2evolution benutzt und eine deutsche Übersetzung vermisst hat, kann also aufatmen ;-) und vielleicht auch nach Fehlern etc. in der Übersetzung schauen, wenn er möchte…

Vielleicht werden auch mehr deutsche Benutzer b2evolution benutzen, da es b2evo nun komplett auf Deutsch gibt? Wer weiß, man wird sehen! :-)

Hübsche Daten mit PHP

On in “Devstuff” by Tblue2 comments
Tags: , ,

Falls jemand einmal in der Lage sein sollte, Daten in PHP “hübsch” (“Heute”, “Gestern”, “am 03.09.2006 um 13:30:42”) darzustellen zu müssen/wollen, habe ich für denjenigen den passenden PHP-Code.

<?php
// Für alle Fälle:
date_default_timezone_set('Europe/Berlin');

// Für deutsche Wochentagsabkürzungen, bei Bedarf entspr. abändern:
setlocale(LC_TIME, 'de_DE');

function nicedate($timestamp = NULL)
{
    if ($timestamp === NULL) {
        $timestamp = time();
    }

    if ($timestamp >= mktime(0, 0, 0) &&
        $timestamp <= mktime(23, 59, 59))
    {
        // Bei Bedarf Datumsformat abändern, siehe auch die anderen
        // zwei strftime()-Aufrufe.
        return strftime('Heute um %H:%M:%S', $timestamp);
    } elseif (
        $timestamp >= mktime(0, 0, 0, date('n'), date('j')-1) &&
        $timestamp <= mktime(23, 59, 59, date('n'), date('j')-1))
    {
        return strftime('Gestern um %H:%M:%S', $timestamp);
    } else {
        return strftime('%a, %d.%m.%y, %H:%M:%S', $timestamp);
    }
}

// Aktuelles Datum:
echo nicedate()."\n";

// Gestern:
echo nicedate(mktime(13, 30, 00, date('n'), date('j')-1))."\n";

// Damals...
echo nicedate(mktime(10, 45, 23, 3, 1, 1999))."\n";

// Beispiel der Konvertierung eines Strings in einen Timestamp,
// siehe auch: http://www.php.net/manual/en/function.strtotime.php
echo nicedate(strtotime('Fri, 18 Jul 2008 14:12:06 GMT'));
?>

Die Ausgabe sieht dann so aus:

Heute um 14:22:32
Gestern um 13:30:00
Mo, 01.03.99, 10:45:23
Gestern um 16:12:06

Vorratsdatenspeicherungs-Pagepeel: Plugin für b2evolution

On in “Devstuff” by Tblue1 comment
Tags: , , ,

Ich machs kurz: Ich habe mir ein b2evolution-Plugin geschrieben, das das Pagepeel des AK Vorratsdatenspeicherung einblendet. Es gibt ein paar Konfigurationseinstellungen, ich bin jetzt allerdings zu müde, das genauer zu erklären. Eine kleine Dokumentation zu den Einstellungen liegt bei.

Download (Version 1.0.2; getestet mit b2evolution 2.4.2, funktioniert evtl. auch mit früheren Versionen; veröffentlicht unter der GPL v2).

Installation: Zip-Archiv entpacken und den enthaltenen Ordner in das Verzeichnis plugins verschieben, im Backend Plugin aktivieren, Blog-IDs in den Plugin-Einstellungen eintragen, freuen. :) Kritik ist natürlich willkommen.

Patch für Phorum 5.2.7: User hinzufügen per ACP

On in “Devstuff” by Tblue
Tags: , , ,

Und noch ein Patch für Phorum. Diesmal fehlte mir die Möglichkeit, neue User direkt im Admin Control Panel hinzufügen zu können und nicht immer den Umweg über das öffentliche Registrierungsformular nehmen zu müssen.

Der Patch besteht aus der Datei useradd.php, die in den Ordner /include/admin gehört und einem Patch, der einen Link (Users/Groups -> Add Users) im ACP-Menü hinzufügt.

Der Patch ist so winzig, dass man ihn per Hand einpflegen kann (eine Zeile). Dazu öffnet man /include/admin/header.php und fügt nach Zeile 460 folgende Zeile ein:

$menu->add('Add Users', 'useradd', 'Allows administrator to add new users.');

Alternativ kann man natürlich auch das Programm patch und das Patchfile (siehe unten) verwenden. Der Befehl patch -p1 < pfad/zur/patchdatei.patch muss im Phorum-Basisverzeichnis ausgeführt werden. So, wie der Befehl hier gezeigt wird, funktioniert er mit (fast?) allen Unix/Linux-Shells.

Downloads:

Auch hier gilt: Ich hafte nicht für etwaige Schäden, die durch diesen Patch entstehen, die Verwendung erfolgt auf eigene Gefahr. Es besteht kein Anspruch auf Funktionstüchtigkeit.

Ansonsten wünsche ich aber viel Vergnügen ;) und ermuntere zu Kritik.

Patch für Phorum 5.2.7: Registrierung deaktivieren

On in “Devstuff” by Tblue
Tags: , , ,

Note

The English version of this post can be found on the Phorum.org support forums. Click here for the post in the “Modules” forum.

Hinweis

Diesen Patch gibt es auch als Modul, siehe Ende des Beitrages.

Der Titel sagt es eigentlich schon. Vor kurzem habe ich mir Phorum 5.2.7 installiert und es als gut befunden. ;) Das einzige, was ich vermisste, war die Möglichkeit, die Registrierung zu deaktivieren. Also habe ich das schnell nachgerüstet.

Mein Patch fügt im Admin-Bereich in den General Settings im Abschnitt User Settings eine Option Enable registration hinzu. Auf No gesetzt bewirkt die Option, dass User beim Versuch, sich zu registrieren, eine Fehlermeldung bekommen. Das Bestätigen eines Accounts ist immer noch möglich und wird vom Patch nicht beeinflusst.

Außerdem wird die Template-Variable RegEnabled gesetzt, so dass man etwaige Links zur Registrierungsseite leicht ausblenden kann.

Auch wird eine neue Sprach-Variable RegDisabled verwendet, die die entsprechende Meldung enthalten sollte (falls die Variable nicht gesetzt ist, wird die englische Meldung angezeigt).

Die drei Standardtemplates von Phorum, die englische Sprachdatei sowie die deutschen Sprachdateien von Oliver Riesen habe ich bereits angepasst.

Download des Patches für Phorum 5.2.7. Wie immer gilt auch hier: Ich hafte nicht für etwaige Schäden, die durch diesen Patch entstehen, die Verwendung erfolgt auf eigene Gefahr. Es gibt keinen Anspruch auf Funktionstüchtigkeit.

Der Patch wird (jedenfalls unter Linux) mit dem Befehl patch angewendet. Das Programm patch ist meistens vorinstalliert oder kann mit Hilfe des Paketmanagers nachinstalliert werden.

Der Befehl muss im Basisverzeichnis von Phorum ausgeführt werden (das Verzeichnis enthält z. B. die Dateien register.php und common.php):

patch -p1 < pfad-zum-patchfile.patch

Damit ist der Patch angewandt. Viel Spaß damit, Kritik bitte hier in den Kommentaren posten.

Update

Module sind immer besser als Patches.

Deshalb gibt es hier nun auch ein Modul (nur lauffähig mit Phorum >= 5.2.7). Aktiviert deaktiviert es die Registrierung und definiert die Template-Variable RegDisabled, so dass Links zu register.php und das Registrierungsformular einfach ausgeblendet werden können.

Für das Modul gilt das gleiche wie für den Patch: Ich hafte nicht für etwaige Schäden, die durch diesen Patch entstehen, die Verwendung erfolgt auf eigene Gefahr. Es gibt keinen Anspruch auf Funktionstüchtigkeit.

b2evolution: Widget visibility hack (English)

On in “Devstuff” by Tblue1 comment
Tags: , , , ,

Note

The patch for b2evolution 2.4.2 can be found in the b2evolution forums.

I’m new to b2evolution and have just migrated another blog from Wordpress to b2evo. Since I’ve closed my old blog at tblue.de (I wanted to start blogging from scratch and the server was really slow, too) I decided to set up a new blog based on b2evo.

Now I’ve read this thread in the b2evo support forums. I was bored so I tried to implement the requested feature (toggle the visibility of a single widget). Of course I had to mess around with the b2evo code (no, the code is great, but I had to understand the relations etc.) but finally I managed it to write this little hack. Maybe the code I’ve written isn’t perfect, so please give me feedback… I also think the icon I used isn’t the right one (it’s the icon for enabling/disabling plugins), could someone offer me a better one? :)

Notes:

  • This hack was tested only by me so far - so don’t be surprised if something does not work as expected.
  • It was tested with b2evolution 2.4.1.
  • Legal stuff: This hack has no warranty for correct operation. I’m not responsible for any damage that can occur due to the use of this hack.

OK, here are the install instructions:

  • Make a backup of your b2evo files and the database.

  • Download the patch file (for b2evo 2.4.1) and patch your files. The patch command has to be executed in the b2evolution root directory (the directory which holds the folders inc, conf etc.). The command you would use under Linux is:

    patch -p1 < path/to/the/patch-file
    
  • Execute the following SQL command in your b2evo database (you can use a tool like PHPMyAdmin to do this):

    ALTER TABLE `evo_widget`
    ADD `wi_show` BOOL NOT NULL DEFAULT '1'
    COMMENT 'visibility hack' AFTER `wi_order`;
    
  • Try the hack and report problems! You can use the comment function of this blog to do that. ;)

Have fun.

P. S.: If my English isn’t the best I’m sorry - I’m not a native English speaker.