Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
e85a00c7
Commit
e85a00c7
authored
Oct 25, 2015
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Freetype: split OS X code to its own file
parent
391590ae
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
132 additions
and
95 deletions
+132
-95
modules/text_renderer/Makefile.am
modules/text_renderer/Makefile.am
+3
-1
modules/text_renderer/fonts/darwin.c
modules/text_renderer/fonts/darwin.c
+129
-0
modules/text_renderer/platform_fonts.c
modules/text_renderer/platform_fonts.c
+0
-94
No files found.
modules/text_renderer/Makefile.am
View file @
e85a00c7
...
...
@@ -17,7 +17,9 @@ endif
if
HAVE_ANDROID
libfreetype_plugin_la_SOURCES
+=
text_renderer/fonts/android.c
endif
if
HAVE_DARWIN
libfreetype_plugin_la_SOURCES
+=
text_renderer/fonts/darwin.c
endif
libfreetype_plugin_la_CPPFLAGS
=
$(AM_CPPFLAGS)
$(FREETYPE_CFLAGS)
libfreetype_plugin_la_LIBADD
=
$(LIBM)
$(FREETYPE_LIBS)
...
...
modules/text_renderer/fonts/darwin.c
0 → 100644
View file @
e85a00c7
/*****************************************************************************
* freetype.c : Put text on the video, using freetype2
*****************************************************************************
* Copyright (C) 2002 - 2015 VLC authors and VideoLAN
* $Id$
*
* Authors: Sigmund Augdal Helberg <dnumgis@videolan.org>
* Gildas Bazin <gbazin@videolan.org>
* Bernie Purcell <bitmap@videolan.org>
* Jean-Baptiste Kempf <jb@videolan.org>
* Felix Paul Kühne <fkuehne@videolan.org>
* Salah-Eddin Shaban <salshaaban@gmail.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation, Inc.,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include <vlc_filter.h>
/* filter_sys_t */
#include <TargetConditionals.h>
#if !TARGET_OS_IPHONE
# include <Carbon/Carbon.h>
#endif
#include <sys/param.h>
/* for MAXPATHLEN */
#include "../platform_fonts.h"
#include "freetype.h"
#if !TARGET_OS_IPHONE
char
*
MacLegacy_Select
(
filter_t
*
p_filter
,
const
char
*
psz_fontname
,
bool
b_bold
,
bool
b_italic
,
int
*
i_idx
,
uni_char_t
codepoint
)
{
VLC_UNUSED
(
b_bold
);
VLC_UNUSED
(
b_italic
);
VLC_UNUSED
(
codepoint
);
FSRef
ref
;
unsigned
char
path
[
MAXPATHLEN
];
char
*
psz_path
;
CFStringRef
cf_fontName
;
ATSFontRef
ats_font_id
;
*
i_idx
=
0
;
if
(
psz_fontname
==
NULL
)
return
NULL
;
msg_Dbg
(
p_filter
,
"looking for %s"
,
psz_fontname
);
cf_fontName
=
CFStringCreateWithCString
(
kCFAllocatorDefault
,
psz_fontname
,
kCFStringEncodingUTF8
);
ats_font_id
=
ATSFontFindFromName
(
cf_fontName
,
kATSOptionFlagsIncludeDisabledMask
);
if
(
ats_font_id
==
0
||
ats_font_id
==
0xFFFFFFFFUL
)
{
msg_Dbg
(
p_filter
,
"ATS couldn't find %s by name, checking family"
,
psz_fontname
);
ats_font_id
=
ATSFontFamilyFindFromName
(
cf_fontName
,
kATSOptionFlagsDefault
);
if
(
ats_font_id
==
0
||
ats_font_id
==
0xFFFFFFFFUL
)
{
msg_Dbg
(
p_filter
,
"ATS couldn't find either %s nor its family, checking PS name"
,
psz_fontname
);
ats_font_id
=
ATSFontFindFromPostScriptName
(
cf_fontName
,
kATSOptionFlagsDefault
);
if
(
ats_font_id
==
0
||
ats_font_id
==
0xFFFFFFFFUL
)
{
msg_Err
(
p_filter
,
"ATS couldn't find %s (no font name, family or PS name)"
,
psz_fontname
);
CFRelease
(
cf_fontName
);
return
NULL
;
}
}
}
CFRelease
(
cf_fontName
);
if
(
noErr
!=
ATSFontGetFileReference
(
ats_font_id
,
&
ref
)
)
{
msg_Err
(
p_filter
,
"ATS couldn't get file ref for %s"
,
psz_fontname
);
return
NULL
;
}
/* i_idx calculation by searching preceding fontIDs */
/* with same FSRef */
{
ATSFontRef
id2
=
ats_font_id
-
1
;
FSRef
ref2
;
while
(
id2
>
0
)
{
if
(
noErr
!=
ATSFontGetFileReference
(
id2
,
&
ref2
)
)
break
;
if
(
noErr
!=
FSCompareFSRefs
(
&
ref
,
&
ref2
)
)
break
;
id2
--
;
}
*
i_idx
=
ats_font_id
-
(
id2
+
1
);
}
if
(
noErr
!=
FSRefMakePath
(
&
ref
,
path
,
sizeof
(
path
)
)
)
{
msg_Err
(
p_filter
,
"failure when getting path from FSRef"
);
return
NULL
;
}
msg_Dbg
(
p_filter
,
"found %s"
,
path
);
psz_path
=
strdup
(
(
char
*
)
path
);
return
psz_path
;
}
#endif
modules/text_renderer/platform_fonts.c
View file @
e85a00c7
...
...
@@ -40,16 +40,6 @@
#include <vlc_input.h>
/* vlc_input_attachment_* */
#include <ctype.h>
/* apple stuff */
#ifdef __APPLE__
# include <TargetConditionals.h>
# if !TARGET_OS_IPHONE
# include <Carbon/Carbon.h>
# endif
# include <sys/param.h>
/* for MAXPATHLEN */
# undef HAVE_FONTCONFIG
#endif
#include "platform_fonts.h"
#include "freetype.h"
...
...
@@ -550,90 +540,6 @@ char* Generic_Select( filter_t *p_filter, const char* psz_family,
return
File_Select
(
SYSTEM_DEFAULT_FONT_FILE
);
}
#ifdef __APPLE__
#if !TARGET_OS_IPHONE
char
*
MacLegacy_Select
(
filter_t
*
p_filter
,
const
char
*
psz_fontname
,
bool
b_bold
,
bool
b_italic
,
int
*
i_idx
,
uni_char_t
codepoint
)
{
VLC_UNUSED
(
b_bold
);
VLC_UNUSED
(
b_italic
);
VLC_UNUSED
(
codepoint
);
FSRef
ref
;
unsigned
char
path
[
MAXPATHLEN
];
char
*
psz_path
;
CFStringRef
cf_fontName
;
ATSFontRef
ats_font_id
;
*
i_idx
=
0
;
if
(
psz_fontname
==
NULL
)
return
NULL
;
msg_Dbg
(
p_filter
,
"looking for %s"
,
psz_fontname
);
cf_fontName
=
CFStringCreateWithCString
(
kCFAllocatorDefault
,
psz_fontname
,
kCFStringEncodingUTF8
);
ats_font_id
=
ATSFontFindFromName
(
cf_fontName
,
kATSOptionFlagsIncludeDisabledMask
);
if
(
ats_font_id
==
0
||
ats_font_id
==
0xFFFFFFFFUL
)
{
msg_Dbg
(
p_filter
,
"ATS couldn't find %s by name, checking family"
,
psz_fontname
);
ats_font_id
=
ATSFontFamilyFindFromName
(
cf_fontName
,
kATSOptionFlagsDefault
);
if
(
ats_font_id
==
0
||
ats_font_id
==
0xFFFFFFFFUL
)
{
msg_Dbg
(
p_filter
,
"ATS couldn't find either %s nor its family, checking PS name"
,
psz_fontname
);
ats_font_id
=
ATSFontFindFromPostScriptName
(
cf_fontName
,
kATSOptionFlagsDefault
);
if
(
ats_font_id
==
0
||
ats_font_id
==
0xFFFFFFFFUL
)
{
msg_Err
(
p_filter
,
"ATS couldn't find %s (no font name, family or PS name)"
,
psz_fontname
);
CFRelease
(
cf_fontName
);
return
NULL
;
}
}
}
CFRelease
(
cf_fontName
);
if
(
noErr
!=
ATSFontGetFileReference
(
ats_font_id
,
&
ref
)
)
{
msg_Err
(
p_filter
,
"ATS couldn't get file ref for %s"
,
psz_fontname
);
return
NULL
;
}
/* i_idx calculation by searching preceding fontIDs */
/* with same FSRef */
{
ATSFontRef
id2
=
ats_font_id
-
1
;
FSRef
ref2
;
while
(
id2
>
0
)
{
if
(
noErr
!=
ATSFontGetFileReference
(
id2
,
&
ref2
)
)
break
;
if
(
noErr
!=
FSCompareFSRefs
(
&
ref
,
&
ref2
)
)
break
;
id2
--
;
}
*
i_idx
=
ats_font_id
-
(
id2
+
1
);
}
if
(
noErr
!=
FSRefMakePath
(
&
ref
,
path
,
sizeof
(
path
)
)
)
{
msg_Err
(
p_filter
,
"failure when getting path from FSRef"
);
return
NULL
;
}
msg_Dbg
(
p_filter
,
"found %s"
,
path
);
psz_path
=
strdup
(
(
char
*
)
path
);
return
psz_path
;
}
#endif
#endif
#ifndef _WIN32
char
*
Dummy_Select
(
filter_t
*
p_filter
,
const
char
*
psz_font
,
bool
b_bold
,
bool
b_italic
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment