Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
5b588b7b
Commit
5b588b7b
authored
May 15, 2015
by
devsaurus
Browse files
implement getStrWidth() and setFontLineSpacingFactor()
parent
de56cb08
Changes
2
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
5b588b7b
...
@@ -426,9 +426,9 @@ In contrast to the source code based inclusion of XBMs into u8glib, it's require
...
@@ -426,9 +426,9 @@ In contrast to the source code based inclusion of XBMs into u8glib, it's require
-
[ ] setPrintPos()
-
[ ] setPrintPos()
-
[ ] setHardwareBackup()
-
[ ] setHardwareBackup()
-
[ ] setRGB()
-
[ ] setRGB()
-
[ ]
g
et
StrWidth
()
-
[ ]
s
et
DefaultMidColor
()
-
[
]
s
et
DefaultMidColor
()
-
[
x
]
g
et
StrWidth
()
-
[
] setFontLineSpacingFactor()
-
[
x
] setFontLineSpacingFactor()
####Control a WS2812 based light strip
####Control a WS2812 based light strip
...
...
app/modules/u8g.c
View file @
5b588b7b
...
@@ -760,6 +760,39 @@ static int lu8g_getHeight( lua_State *L )
...
@@ -760,6 +760,39 @@ static int lu8g_getHeight( lua_State *L )
return
1
;
return
1
;
}
}
// Lua: width = u8g.getStrWidth( self, string )
static
int
lu8g_getStrWidth
(
lua_State
*
L
)
{
lu8g_userdata_t
*
lud
;
if
((
lud
=
get_lud
(
L
))
==
NULL
)
return
0
;
const
char
*
s
=
luaL_checkstring
(
L
,
2
);
if
(
s
==
NULL
)
return
0
;
lua_pushinteger
(
L
,
u8g_GetStrWidth
(
LU8G
,
s
)
);
return
1
;
}
// Lua: u8g.setFontLineSpacingFactor( self, factor )
static
int
lu8g_setFontLineSpacingFactor
(
lua_State
*
L
)
{
lu8g_userdata_t
*
lud
;
if
((
lud
=
get_lud
(
L
))
==
NULL
)
return
0
;
u8g_uint_t
factor
=
luaL_checkinteger
(
L
,
2
);
u8g_SetFontLineSpacingFactor
(
LU8G
,
factor
);
return
0
;
}
// ------------------------------------------------------------
// ------------------------------------------------------------
// comm functions
// comm functions
//
//
...
@@ -1166,12 +1199,14 @@ static const LUA_REG_TYPE lu8g_display_map[] =
...
@@ -1166,12 +1199,14 @@ static const LUA_REG_TYPE lu8g_display_map[] =
{
LSTRKEY
(
"getFontLineSpacing"
),
LFUNCVAL
(
lu8g_getFontLineSpacing
)
},
{
LSTRKEY
(
"getFontLineSpacing"
),
LFUNCVAL
(
lu8g_getFontLineSpacing
)
},
{
LSTRKEY
(
"getHeight"
),
LFUNCVAL
(
lu8g_getHeight
)
},
{
LSTRKEY
(
"getHeight"
),
LFUNCVAL
(
lu8g_getHeight
)
},
{
LSTRKEY
(
"getMode"
),
LFUNCVAL
(
lu8g_getMode
)
},
{
LSTRKEY
(
"getMode"
),
LFUNCVAL
(
lu8g_getMode
)
},
{
LSTRKEY
(
"getStrWidth"
),
LFUNCVAL
(
lu8g_getStrWidth
)
},
{
LSTRKEY
(
"getWidth"
),
LFUNCVAL
(
lu8g_getWidth
)
},
{
LSTRKEY
(
"getWidth"
),
LFUNCVAL
(
lu8g_getWidth
)
},
{
LSTRKEY
(
"nextPage"
),
LFUNCVAL
(
lu8g_nextPage
)
},
{
LSTRKEY
(
"nextPage"
),
LFUNCVAL
(
lu8g_nextPage
)
},
{
LSTRKEY
(
"setColorIndex"
),
LFUNCVAL
(
lu8g_setColorIndex
)
},
{
LSTRKEY
(
"setColorIndex"
),
LFUNCVAL
(
lu8g_setColorIndex
)
},
{
LSTRKEY
(
"setDefaultBackgroundColor"
),
LFUNCVAL
(
lu8g_setDefaultBackgroundColor
)
},
{
LSTRKEY
(
"setDefaultBackgroundColor"
),
LFUNCVAL
(
lu8g_setDefaultBackgroundColor
)
},
{
LSTRKEY
(
"setDefaultForegroundColor"
),
LFUNCVAL
(
lu8g_setDefaultForegroundColor
)
},
{
LSTRKEY
(
"setDefaultForegroundColor"
),
LFUNCVAL
(
lu8g_setDefaultForegroundColor
)
},
{
LSTRKEY
(
"setFont"
),
LFUNCVAL
(
lu8g_setFont
)
},
{
LSTRKEY
(
"setFont"
),
LFUNCVAL
(
lu8g_setFont
)
},
{
LSTRKEY
(
"setFontLineSpacingFactor"
),
LFUNCVAL
(
lu8g_setFontLineSpacingFactor
)
},
{
LSTRKEY
(
"setFontPosBaseline"
),
LFUNCVAL
(
lu8g_setFontPosBaseline
)
},
{
LSTRKEY
(
"setFontPosBaseline"
),
LFUNCVAL
(
lu8g_setFontPosBaseline
)
},
{
LSTRKEY
(
"setFontPosBottom"
),
LFUNCVAL
(
lu8g_setFontPosBottom
)
},
{
LSTRKEY
(
"setFontPosBottom"
),
LFUNCVAL
(
lu8g_setFontPosBottom
)
},
{
LSTRKEY
(
"setFontPosCenter"
),
LFUNCVAL
(
lu8g_setFontPosCenter
)
},
{
LSTRKEY
(
"setFontPosCenter"
),
LFUNCVAL
(
lu8g_setFontPosCenter
)
},
...
...
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