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
f3545179
Commit
f3545179
authored
Apr 17, 2003
by
Emmanuel Puig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* Improved font support for linux (just missing underline parameter )
parent
34964ed5
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
67 deletions
+53
-67
modules/gui/skins/gtk2/gtk2_font.cpp
modules/gui/skins/gtk2/gtk2_font.cpp
+30
-57
modules/gui/skins/gtk2/gtk2_font.h
modules/gui/skins/gtk2/gtk2_font.h
+5
-3
modules/gui/skins/os_font.h
modules/gui/skins/os_font.h
+12
-2
modules/gui/skins/parser/wrappers.cpp
modules/gui/skins/parser/wrappers.cpp
+6
-5
No files found.
modules/gui/skins/gtk2/gtk2_font.cpp
View file @
f3545179
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* gtk2_font.cpp: GTK2 implementation of the Font class
* gtk2_font.cpp: GTK2 implementation of the Font class
*****************************************************************************
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_font.cpp,v 1.
7 2003/04/17 13:46:55
karibu Exp $
* $Id: gtk2_font.cpp,v 1.
8 2003/04/17 15:43:29
karibu Exp $
*
*
* Authors: Cyril Deguet <asmax@videolan.org>
* Authors: Cyril Deguet <asmax@videolan.org>
*
*
...
@@ -32,9 +32,9 @@
...
@@ -32,9 +32,9 @@
//--- SKIN ------------------------------------------------------------------
//--- SKIN ------------------------------------------------------------------
#include "../src/graphics.h"
#include "../src/graphics.h"
#include "
gtk2
_graphics.h"
#include "
../os
_graphics.h"
#include "../src/font.h"
#include "../src/font.h"
#include "
gtk2
_font.h"
#include "
../os
_font.h"
...
@@ -47,45 +47,33 @@ GTK2Font::GTK2Font( intf_thread_t *_p_intf, string fontname, int size,
...
@@ -47,45 +47,33 @@ GTK2Font::GTK2Font( intf_thread_t *_p_intf, string fontname, int size,
{
{
Context
=
gdk_pango_context_get
();
Context
=
gdk_pango_context_get
();
Layout
=
pango_layout_new
(
Context
);
Layout
=
pango_layout_new
(
Context
);
// Text properties setting
FontDesc
=
pango_font_description_new
();
pango_font_description_set_family
(
FontDesc
,
fontname
.
c_str
()
);
pango_font_description_set_size
(
FontDesc
,
size
*
PANGO_SCALE
);
if
(
italic
)
pango_font_description_set_style
(
FontDesc
,
PANGO_STYLE_ITALIC
);
else
pango_font_description_set_style
(
FontDesc
,
PANGO_STYLE_NORMAL
);
pango_font_description_set_weight
(
FontDesc
,
(
PangoWeight
)
weight
);
/* FIXME: underline parameter */
// Set attributes
pango_layout_set_font_description
(
Layout
,
FontDesc
);
}
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
GTK2Font
::~
GTK2Font
()
GTK2Font
::~
GTK2Font
()
{
{
}
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
/*void GTK2Font::AssignGTK2Font( GdkDrawable *DC )
{
// Create font
HGDIOBJ fontObj = CreateFont(
-MulDiv( Size, GetDeviceCaps( DC, LOGPIXELSX ), 72 ),
0,
0, // angle of escapement
0, // base-line orientation angle
Weight, // font weight
Italic, // italic attribute flag
Underline, // underline attribute flag
0, // strikeout attribute flag
ANSI_CHARSET, // character set identifier
OUT_TT_PRECIS, // output precision
0, // clipping precision
ANTIALIASED_QUALITY, // output quality
0, // pitch and family
FontName.c_str() // pointer to typeface name string
);
// Assign font to DC
SelectObject( DC, fontObj );
// Free memory
DeleteObject( fontObj );
// GdkGC *gc = gdk_gc_new( DC );
// gdk_gc_set_font( GFont, gc );
}*/
//---------------------------------------------------------------------------
void
GTK2Font
::
AssignFont
(
Graphics
*
dest
)
void
GTK2Font
::
AssignFont
(
Graphics
*
dest
)
{
{
/* GdkDrawable *DC = ( (GTK2Graphics *)dest )->GetImageHandle();
AssignGTK2Font( DC );*/
}
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
void
GTK2Font
::
GetSize
(
string
text
,
int
&
w
,
int
&
h
)
void
GTK2Font
::
GetSize
(
string
text
,
int
&
w
,
int
&
h
)
...
@@ -97,34 +85,19 @@ void GTK2Font::GetSize( string text, int &w, int &h )
...
@@ -97,34 +85,19 @@ void GTK2Font::GetSize( string text, int &w, int &h )
void
GTK2Font
::
GenericPrint
(
Graphics
*
dest
,
string
text
,
int
x
,
int
y
,
void
GTK2Font
::
GenericPrint
(
Graphics
*
dest
,
string
text
,
int
x
,
int
y
,
int
w
,
int
h
,
int
align
,
int
color
)
int
w
,
int
h
,
int
align
,
int
color
)
{
{
// Get handles
GdkDrawable
*
drawable
=
(
(
GTK2Graphics
*
)
dest
)
->
GetImage
();
GdkDrawable
*
drawable
=
(
(
GTK2Graphics
*
)
dest
)
->
GetImage
();
GdkGC
*
gc
=
(
(
GTK2Graphics
*
)
dest
)
->
GetGC
();
GdkGC
*
gc
=
(
(
GTK2Graphics
*
)
dest
)
->
GetGC
();
/* HDC DC = ( (GTK2Graphics *)dest )->GetImageHandle();
// Set boundaries
LPRECT r = new RECT;
r->left = x;
r->top = y;
r->right = x + w;
r->bottom = y + h;
// Get desktop Device Context
SetBkMode( DC, TRANSPARENT );
// Modify desktop attributes
AssignFont( dest );
// Change text color
// Set text
SetTextColor( DC, color );
pango_layout_set_text
(
Layout
,
text
.
c_str
(),
text
.
length
()
);
pango_layout_set_width
(
Layout
,
w
*
PANGO_SCALE
);
// Draw text on screen
DrawText( DC, text.c_str(), text.length(), r, align );
// Set text color to black to avoid graphic bugs
// Set attributes
SetTextColor( DC, 0 );
pango_layout_set_alignment
(
Layout
,
(
PangoAlignment
)
align
);
gdk_rgb_gc_set_foreground
(
gc
,
color
);
// Free memory
// Render text
delete r;*/
pango_layout_set_text
(
Layout
,
text
.
c_str
(),
text
.
length
()
);
gdk_draw_layout
(
drawable
,
gc
,
x
,
y
,
Layout
);
gdk_draw_layout
(
drawable
,
gc
,
x
,
y
,
Layout
);
}
}
...
...
modules/gui/skins/gtk2/gtk2_font.h
View file @
f3545179
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* gtk2_font.h: GTK2 implementation of the Font class
* gtk2_font.h: GTK2 implementation of the Font class
*****************************************************************************
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_font.h,v 1.
4 2003/04/17 13:46:55
karibu Exp $
* $Id: gtk2_font.h,v 1.
5 2003/04/17 15:43:29
karibu Exp $
*
*
* Authors: Cyril Deguet <asmax@videolan.org>
* Authors: Cyril Deguet <asmax@videolan.org>
*
*
...
@@ -43,6 +43,8 @@ class GTK2Font : Font
...
@@ -43,6 +43,8 @@ class GTK2Font : Font
private:
private:
PangoContext
*
Context
;
PangoContext
*
Context
;
PangoLayout
*
Layout
;
PangoLayout
*
Layout
;
PangoFontDescription
*
FontDesc
;
// Assign font to Device Context
// Assign font to Device Context
virtual
void
AssignFont
(
Graphics
*
dest
);
virtual
void
AssignFont
(
Graphics
*
dest
);
...
...
modules/gui/skins/os_font.h
View file @
f3545179
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* os_font.h: Wrapper for the OSFont class
* os_font.h: Wrapper for the OSFont class
*****************************************************************************
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* Copyright (C) 2003 VideoLAN
* $Id: os_font.h,v 1.
3 2003/04/16 21:40:07 ipkiss
Exp $
* $Id: os_font.h,v 1.
4 2003/04/17 15:43:29 karibu
Exp $
*
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
...
@@ -27,7 +27,17 @@
...
@@ -27,7 +27,17 @@
#if defined( WIN32 )
#if defined( WIN32 )
#include "win32/win32_font.h"
#include "win32/win32_font.h"
#define OSFont Win32Font
#define OSFont Win32Font
#define VLC_FONT_ALIGN_LEFT DT_LEFT
#define VLC_FONT_ALIGN_CENTER DT_CENTER
#define VLC_FONT_ALIGN_RIGHT DT_RIGHT
#else
#else
#include "gtk2/gtk2_font.h"
#include "gtk2/gtk2_font.h"
#define OSFont GTK2Font
#define OSFont GTK2Font
#define VLC_FONT_ALIGN_LEFT PANGO_ALIGN_LEFT
#define VLC_FONT_ALIGN_CENTER PANGO_ALIGN_CENTER
#define VLC_FONT_ALIGN_RIGHT PANGO_ALIGN_RIGHT
#endif
#endif
modules/gui/skins/parser/wrappers.cpp
View file @
f3545179
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* wrappers.cpp: Wrappers around C++ objects
* wrappers.cpp: Wrappers around C++ objects
*****************************************************************************
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* Copyright (C) 2003 VideoLAN
* $Id: wrappers.cpp,v 1.
7 2003/04/16 21:40:07 ipkiss
Exp $
* $Id: wrappers.cpp,v 1.
8 2003/04/17 15:43:30 karibu
Exp $
*
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
...
@@ -38,6 +38,7 @@ extern intf_thread_t *g_pIntf;
...
@@ -38,6 +38,7 @@ extern intf_thread_t *g_pIntf;
#include "../src/banks.h"
#include "../src/banks.h"
#include "../controls/controls.h"
#include "../controls/controls.h"
#include "../src/font.h"
#include "../src/font.h"
#include "../os_font.h"
#include "../src/window.h"
#include "../src/window.h"
#include "../src/theme.h"
#include "../src/theme.h"
#include "../src/skin_common.h"
#include "../src/skin_common.h"
...
@@ -385,12 +386,12 @@ static void ConvertCoords( char *coord, double *p_coord )
...
@@ -385,12 +386,12 @@ static void ConvertCoords( char *coord, double *p_coord )
static
int
ConvertAlign
(
char
*
align
)
static
int
ConvertAlign
(
char
*
align
)
{
{
if
(
strcmp
(
align
,
"left"
)
==
0
)
if
(
strcmp
(
align
,
"left"
)
==
0
)
return
DT
_LEFT
;
return
VLC_FONT_ALIGN
_LEFT
;
else
if
(
strcmp
(
align
,
"right"
)
==
0
)
else
if
(
strcmp
(
align
,
"right"
)
==
0
)
return
DT
_RIGHT
;
return
VLC_FONT_ALIGN
_RIGHT
;
else
if
(
strcmp
(
align
,
"center"
)
==
0
)
else
if
(
strcmp
(
align
,
"center"
)
==
0
)
return
DT
_CENTER
;
return
VLC_FONT_ALIGN
_CENTER
;
else
else
return
DT
_LEFT
;
return
VLC_FONT_ALIGN
_LEFT
;
}
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
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