Blog

Convert Mac PostScript fonts to .dfont file type for use in @font-face generation

Posted on by Brian

First, move your Mac PostScript font to your home folder. Next, in Terminal, type the following line of code:

cat "MyFontReg/..namedfork/rsrc" > "MyFontReg.dfont"

Once converted to the .dfont file type (data fork font, used only in Mac OS X), you can use a service like Font Squirrel to generate your @font-face rules.

You can read up more on old Mac fonts on the Cufon github wiki.

Make sure you have proper licensing to use your fonts for distribution on the web.

Posted in Programming

Tagged ,

Change the post thumbnail crop position in WordPress

Posted on by Brian

By default, WordPress crops the images you upload into the media library from the center to create the various specified thumbnail sizes. If you would like to crop these images starting at a different location, i.e. the top or left, follow the steps below.

Step 1: Open media.php in the wp-includes folder.

Step 2: Search for the function called “image_resize_dimensions” (roughly line 334 in WordPress 3.1.1)

Step 3: Locate the following lines of code in that function:

$s_x = floor( ( $orig_w - $crop_w) / 2 );
$s_y = floor( ( $orig_h - $crop_h) / 2 );

Step 4: Change the values accordingly.

To crop from the top:

$s_y = 0; // floor( ($orig_h - $crop_h) / 2 );

To crop from the left:

$s_x = 0; // floor( ($orig_w - $crop_w) / 2 );

To crop from the top left:

$s_y = 0; // floor( ($orig_h - $crop_h) / 2 );
$s_x = 0; // floor( ($orig_w - $crop_w) / 2 );

Step 5: Save the media.php file.

Step 6: You will have to regenerate your thumbnails for this to work in your site. I would suggest installing and running a plugin called Regenerate Thumbnails or AJAX Thumbnail Rebuild.

Happy cropping.

Posted in Programming

Tagged ,

I’ve got a new blog!

Posted on by Brian

The bbellx WordPress Theme

Welcome to the brand new bbellx blog.

Posted in News, Personal