neutrino: add fribidi support; ported from mohousch's nhd2

This requires libfribidi and a font with arabic or hebrew glyphs.
To build libfribidi add something like this to your makefiles:

FRIBIDI_VER = 0.19.7
$(ARCHIVE)/fribidi-$(FRIBIDI_VER).tar.bz2:
	$(WGET) https://fribidi.org/download/fribidi-$(FRIBIDI_VER).tar.bz2

$(D)/libfribidi: $(ARCHIVE)/fribidi-$(FRIBIDI_VER).tar.bz2 | $(TARGETPREFIX)
	$(REMOVE)/fribidi-$(FRIBIDI_VER)
	$(UNTAR)/fribidi-$(FRIBIDI_VER).tar.bz2
	set -e; cd $(BUILD_TMP)/fribidi-$(FRIBIDI_VER); \
		$(CONFIGURE) \
			--prefix= \
			--mandir=/.remove \
			--disable-debug \
			--disable-deprecated \
			--enable-charsets \
			--with-glib=no \
			; \
		$(MAKE); \
		$(MAKE) install DESTDIR=$(TARGETPREFIX)
	$(REWRITE_PKGCONF) $(PKG_CONFIG_PATH)/fribidi.pc
	$(REWRITE_LIBTOOL)/libfribidi.la
	$(REMOVE)/fribidi-$(FRIBIDI_VER)
	touch $@

If you want to link libfribidi statically add --disable-shared
and --enable-static to configure call.


Origin commit data
------------------
Commit: ffcb1ec609
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-03-30 (Thu, 30 Mar 2017)

Origin message was:
------------------
- neutrino: add fribidi support; ported from mohousch's nhd2

This requires libfribidi and a font with arabic or hebrew glyphs.
To build libfribidi add something like this to your makefiles:

FRIBIDI_VER = 0.19.7
$(ARCHIVE)/fribidi-$(FRIBIDI_VER).tar.bz2:
	$(WGET) https://fribidi.org/download/fribidi-$(FRIBIDI_VER).tar.bz2

$(D)/libfribidi: $(ARCHIVE)/fribidi-$(FRIBIDI_VER).tar.bz2 | $(TARGETPREFIX)
	$(REMOVE)/fribidi-$(FRIBIDI_VER)
	$(UNTAR)/fribidi-$(FRIBIDI_VER).tar.bz2
	set -e; cd $(BUILD_TMP)/fribidi-$(FRIBIDI_VER); \
		$(CONFIGURE) \
			--prefix= \
			--mandir=/.remove \
			--disable-debug \
			--disable-deprecated \
			--enable-charsets \
			--with-glib=no \
			; \
		$(MAKE); \
		$(MAKE) install DESTDIR=$(TARGETPREFIX)
	$(REWRITE_PKGCONF) $(PKG_CONFIG_PATH)/fribidi.pc
	$(REWRITE_LIBTOOL)/libfribidi.la
	$(REMOVE)/fribidi-$(FRIBIDI_VER)
	touch $@

If you want to link libfribidi statically add --disable-shared
and --enable-static to configure call.
This commit is contained in:
vanhofen
2017-03-30 23:04:26 +02:00
parent 2f636cd9f3
commit a95874932e
4 changed files with 88 additions and 0 deletions

View File

@@ -35,6 +35,10 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef ENABLE_FRIBIDI
#include <fribidi/fribidi.h>
#endif
FT_Error LcdFontRenderClass::myFTC_Face_Requester(FTC_FaceID face_id,
FT_Library /*library*/,
FT_Pointer request_data,
@@ -230,11 +234,20 @@ extern int UTF8ToUnicode(const char * &text, const bool utf8_encoded); // return
}
#endif
#ifdef ENABLE_FRIBIDI
std::string fribidi_shape_char(const char * text);
#endif
void LcdFont::RenderString(int x, int y, const int width, const char * text, const int color, const int selected, const bool utf8_encoded)
{
int err;
pthread_mutex_lock(&renderer->render_mutex);
#ifdef ENABLE_FRIBIDI
std::string Text = fribidi_shape_char(text);
text = Text.c_str();
#endif
FTC_ScalerRec scaler;
scaler.face_id = font.face_id;
@@ -311,6 +324,12 @@ void LcdFont::RenderString(int x, int y, const int width, const char * text, con
int LcdFont::getRenderWidth(const char * text, const bool utf8_encoded)
{
pthread_mutex_lock(&renderer->render_mutex);
#ifdef ENABLE_FRIBIDI
std::string Text = fribidi_shape_char(text);
text = Text.c_str();
#endif
FT_Error err;
FTC_ScalerRec scaler;
scaler.face_id = font.face_id;