# STM publishing: tools, technologies and changeA WordPress site for STM Publishing

11Sep/12Off

## The Mysterious etaoin shrdlu

#### Posted by Graham Douglas

I just love this story, from a preview trailer of Linotype: The Film.

26Feb/12Off

## One way to compile GNU Fribidi as a static library (.lib) using Visual Studio

#### Posted by Graham Douglas

Yesterday I spent about half an hour seeing if I could get GNU Fribidi C library (version 0.19.2) to build as a static library (.lib) under Windows, using Visual Studio. Well, I cheated a bit and used my MinGW/MSYS install (which I use to build LuaTeX) in order to create the config.h header. However, it built OK so I thought I'd share what I did; but do please be aware that I've not yet fully tested the .lib I built so use these notes with care. I merely provide them as a starting point.

## config.h

If you've ever used MinGW/MSYS or Linux build tools you'll know that config.h is a header file created through the standard Linux-based build process. In essence, config.h sets a number of #defines based on your MinGW/MSYS build environment: you need to transfer the resulting config.h to include it within your Visual Studio project. However, the point to note is that the config.h generated by the MinGW/MSYS build process may create #defines which "switch on" certain headers etc that are "not available" to your Visual Studio setup. What I do is comment out a few of the config.h #defines to get a set that works. This is a bit kludgy, but to date it has usually worked out for me. If you don't have MinGW/MSYS installed, you can download the config.h I generated and tweaked. Again, I make no guarantees it'll work for you.

## An important Preprocessor Definition

Within the Preprocessor Definitions options of your Visual Studio project you need to add one called HAVE_CONFIG_H which basically enables the use of config.h.

## Two minor changes to the source code

Because I'm building a static library (.lib) I made two tiny edits to the source code. Again, there are better ways to do this properly. The change is to the definition of FRIBIDI_ENTRY. Within common.h and fribidi-common.h there are tests for WIN32 which end up setting:

#define FRIBIDI_ENTRY __declspec(dllexport)

For example, in common.h

 ... #if (defined(WIN32)) || (defined(_WIN32_WCE)) #define FRIBIDI_ENTRY __declspec(dllexport) #endif /* WIN32 */ ... 

I edited this to

#if (defined(WIN32)) || (defined(_WIN32_WCE)) #define FRIBIDI_ENTRY #endif /* WIN32 */

i.e., remove the __declspec(dllexport). Similarly in fribidi-common.h.

## One more setting

Within fribidi-config.h I ensured that the FRIBIDI_CHARSETS was set to 1:

#define FRIBIDI_CHARSETS 1

# And finally

You simply need to create a new static library project and make sure that all the relevant include paths are set correctly and then try the edits and settings suggested above to see if they work for you. Here is a screenshot of my project showing the C code files I added to the project. The C files are included in the ...\charset and ...\lib folders of the C source distribution.

With the above steps the library built with just 2 level 4 compiler warnings (that is, after I had included the _CRT_SECURE_NO_WARNINGS directive to disable deprecation). I hope these notes are useful, but do please note that I have not thoroughly tested the resulting .lib file so please be sure that you perform your own due diligence.

14Feb/12Off

## Some papers on TeX’s math typesetting algorithms

#### Posted by Graham Douglas

Just a brief post to share a list of papers which describe many interesting and low-level details of math typesetting, including TeX's algorithms and math fonts.