Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
20b81062
Commit
20b81062
authored
Apr 19, 2003
by
Emmanuel Puig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* Font fixed
parent
b06e5e49
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
32 deletions
+34
-32
modules/gui/skins/gtk2/gtk2_font.cpp
modules/gui/skins/gtk2/gtk2_font.cpp
+30
-30
modules/gui/skins/gtk2/gtk2_graphics.cpp
modules/gui/skins/gtk2/gtk2_graphics.cpp
+4
-2
No files found.
modules/gui/skins/gtk2/gtk2_font.cpp
View file @
20b81062
...
@@ -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.1
0 2003/04/19 02:34:47
karibu Exp $
* $Id: gtk2_font.cpp,v 1.1
1 2003/04/19 12:39:14
karibu Exp $
*
*
* Authors: Cyril Deguet <asmax@videolan.org>
* Authors: Cyril Deguet <asmax@videolan.org>
* Emmanuel Puig <karibu@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
...
@@ -50,22 +50,29 @@ GTK2Font::GTK2Font( intf_thread_t *_p_intf, string fontname, int size,
...
@@ -50,22 +50,29 @@ GTK2Font::GTK2Font( intf_thread_t *_p_intf, string fontname, int size,
Layout
=
pango_layout_new
(
Context
);
Layout
=
pango_layout_new
(
Context
);
// Text properties setting
// Text properties setting
FontDesc
=
pango_font_description_new
();
FontDesc
=
pango_font_description_new
();
pango_font_description_set_family
(
FontDesc
,
fontname
.
c_str
()
);
pango_font_description_set_family
(
FontDesc
,
fontname
.
c_str
()
);
pango_font_description_set_size
(
FontDesc
,
size
*
PANGO_SCALE
);
pango_font_description_set_size
(
FontDesc
,
size
*
PANGO_SCALE
);
if
(
italic
)
if
(
italic
)
{
pango_font_description_set_style
(
FontDesc
,
PANGO_STYLE_ITALIC
);
pango_font_description_set_style
(
FontDesc
,
PANGO_STYLE_ITALIC
);
}
else
else
{
pango_font_description_set_style
(
FontDesc
,
PANGO_STYLE_NORMAL
);
pango_font_description_set_style
(
FontDesc
,
PANGO_STYLE_NORMAL
);
}
pango_font_description_set_weight
(
FontDesc
,
(
PangoWeight
)
weight
);
pango_font_description_set_weight
(
FontDesc
,
(
PangoWeight
)
weight
);
/* FIXME: underline parameter */
/* FIXME: underline parameter */
// Set attributes
// Set attributes
//PangoFont* font = pango_context_load_font( Context, FontDesc );
//pango_context_set_font_description( Context, FontDesc );
pango_layout_set_font_description
(
Layout
,
FontDesc
);
pango_layout_set_font_description
(
Layout
,
FontDesc
);
}
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
...
@@ -86,43 +93,36 @@ void GTK2Font::GetSize( string text, int &w, int &h )
...
@@ -86,43 +93,36 @@ 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
();
GdkGC
*
gc
=
(
(
GTK2Graphics
*
)
dest
)
->
GetGC
();
// Set text
// Set text
pango_layout_set_text
(
Layout
,
text
.
c_str
(),
text
.
length
()
);
pango_layout_set_text
(
Layout
,
text
.
c_str
(),
-
1
);
// Set size
// Set size
pango_layout_set_width
(
Layout
,
-
1
);
int
real_w
,
real_h
;
int
real_w
,
real_h
;
GetSize
(
text
,
real_w
,
real_h
);
if
(
real_w
>
w
)
// Create buffer image
{
Graphics
*
cov
=
(
Graphics
*
)
new
OSGraphics
(
w
,
h
);
// Change clipping region
cov
->
CopyFrom
(
0
,
0
,
w
,
h
,
dest
,
x
,
y
,
SRC_COPY
);
Region
*
TextClipRgn
=
(
Region
*
)
new
OSRegion
(
x
,
y
,
w
,
h
);
dest
->
SetClipRegion
(
TextClipRgn
);
// Get handles
delete
TextClipRgn
;
GdkDrawable
*
drawable
=
(
(
GTK2Graphics
*
)
cov
)
->
GetImage
();
GdkGC
*
gc
=
(
(
GTK2Graphics
*
)
cov
)
->
GetGC
();
w
=
real_w
;
if
(
align
==
VLC_FONT_ALIGN_RIGHT
)
// Set width of text
x
+=
w
-
real_w
;
pango_layout_set_width
(
Layout
,
w
*
PANGO_SCALE
);
else
if
(
align
==
VLC_FONT_ALIGN_CENTER
)
x
+=
(
w
-
real_w
)
/
2
;
// Put old clip region
dest
->
ResetClipRegion
();
}
else
{
pango_layout_set_width
(
Layout
,
w
*
PANGO_SCALE
);
}
// Set attributes
// Set attributes
pango_layout_set_alignment
(
Layout
,
(
PangoAlignment
)
align
);
pango_layout_set_alignment
(
Layout
,
(
PangoAlignment
)
align
);
gdk_rgb_gc_set_foreground
(
gc
,
color
);
gdk_rgb_gc_set_foreground
(
gc
,
color
);
// Render text
// Render text on buffer
gdk_draw_layout
(
drawable
,
gc
,
x
,
y
,
Layout
);
gdk_draw_layout
(
drawable
,
gc
,
0
,
0
,
Layout
);
// Copy buffer on dest graphics
dest
->
CopyFrom
(
x
,
y
,
w
,
h
,
cov
,
0
,
0
,
SRC_COPY
);
// Free memory
delete
(
OSGraphics
*
)
cov
;
}
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
...
...
modules/gui/skins/gtk2/gtk2_graphics.cpp
View file @
20b81062
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* gtk2_graphics.cpp: GTK2 implementation of the Graphics and Region classes
* gtk2_graphics.cpp: GTK2 implementation of the Graphics and Region classes
*****************************************************************************
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_graphics.cpp,v 1.1
3 2003/04/19 02:34:47
karibu Exp $
* $Id: gtk2_graphics.cpp,v 1.1
4 2003/04/19 12:39:14
karibu Exp $
*
*
* Authors: Cyril Deguet <asmax@videolan.org>
* Authors: Cyril Deguet <asmax@videolan.org>
* Emmanuel Puig <karibu@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
...
@@ -50,7 +50,8 @@ GTK2Graphics::GTK2Graphics( int w, int h, Window *from ) : Graphics( w, h )
...
@@ -50,7 +50,8 @@ GTK2Graphics::GTK2Graphics( int w, int h, Window *from ) : Graphics( w, h )
}
}
else
else
{
{
Image
=
(
GdkDrawable
*
)
gdk_pixmap_new
(
NULL
,
w
,
h
,
8
);
// FIXME: 8 -> screen depth
Image
=
(
GdkDrawable
*
)
gdk_pixmap_new
(
NULL
,
w
,
h
,
16
);
gdk_drawable_set_colormap
(
Image
,
gdk_colormap_get_system
()
);
gdk_drawable_set_colormap
(
Image
,
gdk_colormap_get_system
()
);
Gc
=
gdk_gc_new
(
Image
);
Gc
=
gdk_gc_new
(
Image
);
}
}
...
@@ -74,6 +75,7 @@ void GTK2Graphics::CopyFrom( int dx, int dy, int dw, int dh, Graphics *Src,
...
@@ -74,6 +75,7 @@ void GTK2Graphics::CopyFrom( int dx, int dy, int dw, int dh, Graphics *Src,
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
void
GTK2Graphics
::
DrawRect
(
int
x
,
int
y
,
int
w
,
int
h
,
int
color
)
void
GTK2Graphics
::
DrawRect
(
int
x
,
int
y
,
int
w
,
int
h
,
int
color
)
{
{
gdk_rgb_gc_set_foreground
(
Gc
,
color
);
gdk_draw_rectangle
(
Image
,
Gc
,
TRUE
,
x
,
y
,
w
,
h
);
gdk_draw_rectangle
(
Image
,
Gc
,
TRUE
,
x
,
y
,
w
,
h
);
}
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
...
...
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