{"id":3062,"date":"2013-08-12T11:34:10","date_gmt":"2013-08-12T11:34:10","guid":{"rendered":"http:\/\/www.readytext.co.uk\/?p=3062"},"modified":"2013-11-28T08:11:09","modified_gmt":"2013-11-28T08:11:09","slug":"building-harfbuzz-as-a-static-library-using-microsoft-visual-studio","status":"publish","type":"post","link":"https:\/\/www.readytext.co.uk\/?p=3062","title":{"rendered":"Building HarfBuzz as a static library using Microsoft Visual Studio"},"content":{"rendered":"<h1>Introduction: A very brief post<\/h1>\n<p>This is an extremely short post to note one way of building the superb <a href=\"http:\/\/www.freedesktop.org\/wiki\/Software\/HarfBuzz\/\">HarfBuzz<\/a> OpenType shaping library as a static library on Windows (i.e., a .lib) &ndash; using an elderly version of Visual Studio (2008)! The screenshot below shows the source files I included into my VS2008 project and the files I excluded from the build (the excluded files have a little red minus sign next to them). In short, I did not build HarfBuzz for use with ICU, Graphite or Uniscribe and excluded a few other source files that were not necessary for (my version of) a successful build. I&#8217;ve tested the <code>.lib<\/code> and, so far, it works well for what I need &ndash; but, of course, be sure to run your on tests! You will also need the <a href=\"http:\/\/www.freetype.org\/\">FreeType<\/a> library as well, which I also built as a static library. HarfBuzz also compiles nicely using MinGW to give you a DLL, but I personally prefer to build a native Windows .lib if I can get one built (without too much pain&#8230;)<\/p>\n<p>Here are the preprocessor definitions that I needed to set for the project<\/p>\n<p><code>WIN32<br \/>\n_DEBUG<br \/>\n_LIB<br \/>\n_CRT_SECURE_NO_WARNINGS<br \/>\nHAVE_OT<br \/>\nHAVE_UCDN<\/code><\/p>\n<blockquote><p>A tip, of sorts, or at least something that worked for me. When using the HarfBuzz library UTF16 buffer functions in your own code, you may need to ensure that the <code>wchar_t<\/code> type is <em>not<\/em> treated as a built-in type. For example, using wide characters like this <code>const wchar_t* text = L\"\u0647\u064e\u0645\u0652\u0632\u064e\u0629 \u0648\u064e\u0635\u0652\u0644 \u0622\";<\/code> and, say, <code>hb_buffer_add_utf16( buffer, text, wcslen(text), 0, wcslen(text) );<\/code>. Within the project property pages, Set <code>C\/C++ -> Language -> Treat wchar_t as Built-in Type = No<\/code> <\/p><\/blockquote>\n<p>Here&#8217;s the list of files displayed in Visual Studio<\/p>\n<p><img decoding=\"async\" src=\".\/files\/winharfbuzz.png\" width=\"100%\"\/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction: A very brief post This is an extremely short post to note one way of building the superb HarfBuzz OpenType shaping library as a static library on Windows (i.e., a .lib) &ndash; using an elderly version of Visual Studio (2008)! The screenshot below shows the source files I included into my VS2008 project and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,16,10,17],"tags":[],"class_list":["post-3062","post","type-post","status-publish","format-standard","hentry","category-arabic","category-typesetting-and-algorithms","category-unicode","category-unicode-arabic"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/3062","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3062"}],"version-history":[{"count":15,"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/3062\/revisions"}],"predecessor-version":[{"id":3216,"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/3062\/revisions\/3216"}],"wp:attachment":[{"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3062"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3062"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3062"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}