author | Radek Brich <radek.brich@devl.cz> |
Fri, 04 Jan 2013 00:13:59 +0100 | |
changeset 45 | 43b2279b06e1 |
parent 25 | f69a1f0382ce |
permissions | -rw-r--r-- |
25
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
1 |
# Add Font.render_glyph() method to PyGame. |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
2 |
# |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
3 |
# This is nicer than full string rendering, as Tuikit renders screen |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
4 |
# one character at the time and render_glyph is optimized for caching. |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
5 |
# See documentation for TTF_RenderGlyph_Shaded and TTF_GlyphMetrics. |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
6 |
# |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
7 |
# Radek Brich <radek.brich@devl.cz> |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
8 |
diff -rupd pygame-1.9.1release/src/font.c pygame-1.9.1release-my/src/font.c |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
9 |
--- pygame-1.9.1release/src/font.c 2009-06-17 01:18:34.000000000 +0200 |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
10 |
+++ pygame-1.9.1release-my/src/font.c 2011-10-09 23:19:46.000000000 +0200 |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
11 |
@@ -371,6 +371,78 @@ font_render (PyObject* self, PyObject* a |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
12 |
} |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
13 |
|
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
14 |
static PyObject* |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
15 |
+font_render_glyph (PyObject* self, PyObject* args) |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
16 |
+{ |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
17 |
+ TTF_Font* font = PyFont_AsFont (self); |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
18 |
+ int aa; |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
19 |
+ PyObject* text, *final; |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
20 |
+ PyObject* fg_rgba_obj, *bg_rgba_obj = NULL; |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
21 |
+ Uint8 rgba[4]; |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
22 |
+ SDL_Surface* surf; |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
23 |
+ SDL_Color foreg, backg; |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
24 |
+ |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
25 |
+ if (!PyArg_ParseTuple (args, "OiO|O", &text, &aa, &fg_rgba_obj, |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
26 |
+ &bg_rgba_obj)) |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
27 |
+ return NULL; |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
28 |
+ |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
29 |
+ if (!RGBAFromColorObj (fg_rgba_obj, rgba)) |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
30 |
+ return RAISE (PyExc_TypeError, "Invalid foreground RGBA argument"); |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
31 |
+ foreg.r = rgba[0]; |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
32 |
+ foreg.g = rgba[1]; |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
33 |
+ foreg.b = rgba[2]; |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
34 |
+ if (bg_rgba_obj) |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
35 |
+ { |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
36 |
+ if (!RGBAFromColorObj (bg_rgba_obj, rgba)) |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
37 |
+ return RAISE (PyExc_TypeError, "Invalid background RGBA argument"); |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
38 |
+ backg.r = rgba[0]; |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
39 |
+ backg.g = rgba[1]; |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
40 |
+ backg.b = rgba[2]; |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
41 |
+ backg.unused = 0; |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
42 |
+ } |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
43 |
+ else |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
44 |
+ { |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
45 |
+ backg.r = 0; |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
46 |
+ backg.g = 0; |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
47 |
+ backg.b = 0; |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
48 |
+ backg.unused = 0; |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
49 |
+ } |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
50 |
+ |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
51 |
+ if (PyUnicode_Check (text) && PyObject_Length (text) == 1) |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
52 |
+ { |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
53 |
+ Py_UNICODE *buf = PyUnicode_AsUnicode (text); |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
54 |
+ Uint16 ch = (Uint16) buf[0]; |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
55 |
+ |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
56 |
+ if (aa) |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
57 |
+ { |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
58 |
+ if (!bg_rgba_obj) |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
59 |
+ surf = TTF_RenderGlyph_Blended (font, ch, foreg); |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
60 |
+ else |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
61 |
+ surf = TTF_RenderGlyph_Shaded (font, ch, foreg, backg); |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
62 |
+ } |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
63 |
+ else |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
64 |
+ surf = TTF_RenderGlyph_Solid (font, ch, foreg); |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
65 |
+ } |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
66 |
+ else |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
67 |
+ return RAISE (PyExc_TypeError, "char must be string of exactly one unicode character"); |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
68 |
+ |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
69 |
+ if (!surf) |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
70 |
+ return RAISE (PyExc_SDLError, TTF_GetError()); |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
71 |
+ |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
72 |
+ if (!aa && bg_rgba_obj) /*turn off transparancy*/ |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
73 |
+ { |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
74 |
+ SDL_SetColorKey (surf, 0, 0); |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
75 |
+ surf->format->palette->colors[0].r = backg.r; |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
76 |
+ surf->format->palette->colors[0].g = backg.g; |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
77 |
+ surf->format->palette->colors[0].b = backg.b; |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
78 |
+ } |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
79 |
+ |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
80 |
+ final = PySurface_New (surf); |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
81 |
+ if (!final) |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
82 |
+ SDL_FreeSurface (surf); |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
83 |
+ return final; |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
84 |
+} |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
85 |
+ |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
86 |
+static PyObject* |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
87 |
font_size (PyObject* self, PyObject* args) |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
88 |
{ |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
89 |
TTF_Font* font = PyFont_AsFont (self); |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
90 |
@@ -509,6 +581,7 @@ static PyMethodDef font_methods[] = |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
91 |
|
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
92 |
{ "metrics", font_metrics, METH_VARARGS, DOC_FONTMETRICS }, |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
93 |
{ "render", font_render, METH_VARARGS, DOC_FONTRENDER }, |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
94 |
+ { "render_glyph", font_render_glyph, METH_VARARGS, DOC_FONTRENDERGLYPH }, |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
95 |
{ "size", font_size, METH_VARARGS, DOC_FONTSIZE }, |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
96 |
|
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
97 |
{ NULL, NULL, 0, NULL } |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
98 |
diff -rupd pygame-1.9.1release/src/pygamedocs.h pygame-1.9.1release-my/src/pygamedocs.h |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
99 |
--- pygame-1.9.1release/src/pygamedocs.h 2009-06-19 08:20:25.000000000 +0200 |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
100 |
+++ pygame-1.9.1release-my/src/pygamedocs.h 2011-10-09 23:27:34.000000000 +0200 |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
101 |
@@ -299,6 +299,8 @@ |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
102 |
|
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
103 |
#define DOC_FONTRENDER "Font.render(text, antialias, color, background=None): return Surface\ndraw text on a new Surface" |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
104 |
|
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
105 |
+#define DOC_FONTRENDERGLYPH "Font.render_glyph(char, antialias, color, background=None): return Surface\ndraw glyph of char on a new Surface" |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
106 |
+ |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
107 |
#define DOC_FONTSIZE "Font.size(text): return (width, height)\ndetermine the amount of space needed to render text" |
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
108 |
|
f69a1f0382ce
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
109 |
#define DOC_FONTSETUNDERLINE "Font.set_underline(bool): return None\ncontrol if text is rendered with an underline" |