123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- From 46e8bdc28b1ca32ca4620e64a4159f64cfb0f301 Mon Sep 17 00:00:00 2001
- From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
- Date: Wed, 22 Jan 2014 13:55:16 +0100
- Subject: [PATCH 07/10] freetype: added a fake font lookup mechanism for iOS to
- use the packaged demo fonts
- ---
- modules/text_renderer/freetype.c | 2 ++
- modules/text_renderer/platform_fonts.c | 40 ++++++++++++++++++++++++++++++++++
- modules/text_renderer/platform_fonts.h | 3 +++
- 3 files changed, 45 insertions(+)
- diff --git a/modules/text_renderer/freetype.c b/modules/text_renderer/freetype.c
- index e562afc..378df0b 100644
- --- a/modules/text_renderer/freetype.c
- +++ b/modules/text_renderer/freetype.c
- @@ -1972,6 +1972,8 @@ static int Create( vlc_object_t *p_this )
- #elif defined( __APPLE__ )
- #if !TARGET_OS_IPHONE
- p_sys->pf_select = MacLegacy_Select;
- +#else
- + p_sys->pf_select = iOSFake_Select;
- #endif
- #elif defined( _WIN32 ) && defined( HAVE_GET_FONT_BY_FAMILY_NAME )
- p_sys->pf_select = Win32_Select;
- diff --git a/modules/text_renderer/platform_fonts.c b/modules/text_renderer/platform_fonts.c
- index 7869dba..deeaa7d 100644
- --- a/modules/text_renderer/platform_fonts.c
- +++ b/modules/text_renderer/platform_fonts.c
- @@ -42,6 +42,9 @@
- #include <TargetConditionals.h>
- #if !TARGET_OS_IPHONE
- #include <Carbon/Carbon.h>
- +#else
- +#include <CoreFoundation/CoreFoundation.h>
- +#include <vlc_url.h>
- #endif
- #include <sys/param.h> /* for MAXPATHLEN */
- #undef HAVE_FONTCONFIG
- @@ -405,6 +408,43 @@ char* MacLegacy_Select( filter_t *p_filter, const char* psz_fontname,
-
- return psz_path;
- }
- +#else
- +char *iOSFake_Select( filter_t *p_filter, const char* psz_fontname,
- + bool b_bold, bool b_italic, int i_size, int *i_idx )
- +{
- + VLC_UNUSED(p_filter);
- + VLC_UNUSED(psz_fontname);
- + VLC_UNUSED(b_bold);
- + VLC_UNUSED(b_italic);
- + VLC_UNUSED(i_size);
- + VLC_UNUSED(i_idx);
- +
- + CFURLRef fileURL;
- + fileURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(),
- + CFSTR("OpenSans-Regular.ttf"),
- + NULL,
- + NULL);
- + if (!fileURL)
- + return NULL;
- + CFStringRef urlString = CFURLCopyFileSystemPath(fileURL, kCFURLPOSIXPathStyle);
- + CFRelease(fileURL);
- +
- + if (!urlString)
- + return NULL;
- +
- + CFIndex length = CFStringGetLength(urlString);
- + if (!length)
- + return NULL;
- + length++;
- +
- + char *psz_path = (char *)malloc(length);
- + CFStringGetCString(urlString, psz_path, length, kCFStringEncodingUTF8);
- + CFRelease(urlString);
- +
- + psz_path = strdup(psz_path);
- +
- + return psz_path;
- +}
- #endif
- #endif
-
- diff --git a/modules/text_renderer/platform_fonts.h b/modules/text_renderer/platform_fonts.h
- index cff52b1..40b25fb 100644
- --- a/modules/text_renderer/platform_fonts.h
- +++ b/modules/text_renderer/platform_fonts.h
- @@ -95,6 +95,9 @@ char* Win32_Select( filter_t *p_filter, const char* family,
- #if !TARGET_OS_IPHONE
- char* MacLegacy_Select( filter_t *p_filter, const char* psz_fontname,
- bool b_bold, bool b_italic, int i_size, int *i_idx );
- +#else
- +char *iOSFake_Select( filter_t *p_filter, const char* psz_fontname,
- + bool b_bold, bool b_italic, int i_size, int *i_idx );
- #endif
- #endif
-
- --
- 1.9.3 (Apple Git-50)
|