Skip to content

Commit

Permalink
feat(font): add operation functions for TextStyle
Browse files Browse the repository at this point in the history
  • Loading branch information
lc-soft committed May 5, 2021
1 parent 923a817 commit c0ccdf8
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/LCUI/font/textlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ LCUI_API int TextLayer_SetFixedSize(LCUI_TextLayer layer, int width,
LCUI_API int TextLayer_SetMaxSize(LCUI_TextLayer layer, int width, int height);

/** 设置是否启用多行文本模式 */
LCUI_API void TextLayer_SetMultiline(LCUI_TextLayer layer, int is_true);
LCUI_API void TextLayer_SetMultiline(LCUI_TextLayer layer, LCUI_BOOL enabled);

/** 删除文本光标的当前坐标右边的文本 */
LCUI_API int TextLayer_TextDelete(LCUI_TextLayer layer, int n_char);
Expand All @@ -225,7 +225,7 @@ LCUI_API void TextLayer_SetWordBreak(LCUI_TextLayer layer,
LCUI_WordBreakMode mode);

/** 设置是否使用样式标签 */
LCUI_API void TextLayer_EnableStyleTag(LCUI_TextLayer layer, LCUI_BOOL is_true);
LCUI_API void TextLayer_EnableStyleTag(LCUI_TextLayer layer, LCUI_BOOL enabled);

/** 重新载入各个文字的字体位图 */
LCUI_API void TextLayer_ReloadCharBitmap(LCUI_TextLayer layer);
Expand Down
6 changes: 6 additions & 0 deletions include/LCUI/font/textstyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ LCUI_API int TextStyle_SetStyle(LCUI_TextStyle ts, LCUI_FontStyle style);
*/
LCUI_API int TextStyle_SetFont(LCUI_TextStyle ts, const char *str);

LCUI_API void TextStyle_SetSize(LCUI_TextStyle ts, int pixel_size);

LCUI_API void TextStyle_SetForeColor(LCUI_TextStyle ts, LCUI_Color color);

LCUI_API void TextStyle_SetBackColor(LCUI_TextStyle ts, LCUI_Color color);

/** 设置使用默认的字体 */
int TextStyle_SetDefaultFont(LCUI_TextStyle ts);

Expand Down
18 changes: 18 additions & 0 deletions src/font/textstyle.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,24 @@ void TextStyle_Merge(LCUI_TextStyle base, LCUI_TextStyle target)
}
}

void TextStyle_SetSize(LCUI_TextStyle ts, int pixel_size)
{
ts->pixel_size = pixel_size;
ts->has_pixel_size = TRUE;
}

void TextStyle_SetForeColor(LCUI_TextStyle ts, LCUI_Color color)
{
ts->fore_color = color;
ts->has_fore_color = TRUE;
}

void TextStyle_SetBackColor(LCUI_TextStyle ts, LCUI_Color color)
{
ts->back_color = color;
ts->has_back_color = TRUE;
}

int TextStyle_SetWeight(LCUI_TextStyle ts, LCUI_FontWeight weight)
{
int *font_ids;
Expand Down

0 comments on commit c0ccdf8

Please sign in to comment.