*/}}
浏览代码

Use one line flag

Yiming Wu 2 年之前
父节点
当前提交
2171a446fa
共有 2 个文件被更改,包括 3 次插入1 次删除
  1. 1 0
      la_interface.h
  2. 2 1
      la_tns_kernel.c

+ 1 - 0
la_interface.h

@@ -924,6 +924,7 @@ STRUCTURE(laWidget){
 #define LA_UI_FLAGS_HIGHLIGHT  (1<<21)
 #define LA_UI_FLAGS_NODE_CONTAINER (1<<22)
 #define LA_UI_COLLECTION_NO_HIGHLIGHT LA_TEXT_ALIGN_LEFT
+#define LA_TEXT_ONE_LINE       (1<<23)
 
 #define LA_UI_FLAGS_INT_ICON  (LA_UI_FLAGS_NO_DECAL|LA_UI_FLAGS_NO_EVENT|LA_UI_FLAGS_ICON)
 #define LA_UI_FLAGS_PLAIN     (LA_UI_FLAGS_NO_DECAL|LA_UI_FLAGS_NO_EVENT)

+ 2 - 1
la_tns_kernel.c

@@ -3066,6 +3066,7 @@ void tnsDrawStringM(char *content, uint32_t* contentU, real Color[4], int L, int
     int FscHeight, RestoreI;
     int RevY=(Flags&LA_TEXT_REVERT_Y);
     int UseMono=(Flags&LA_TEXT_MONO);
+    int OneLine=(Flags&LA_TEXT_ONE_LINE);
 
     int any=0, UC=1; int BreakNow=0;
     for (i = 0; i < len && UC; i+=advance){
@@ -3073,7 +3074,7 @@ void tnsDrawStringM(char *content, uint32_t* contentU, real Color[4], int L, int
         tnsFontSingleCharacter *fsc;
         int cx, cy;
 
-        if (UC == L'\n'){ sx = L; sy += LA_RH; continue; }
+        if (UC == L'\n'){ if(!OneLine){sx = L; sy += LA_RH; continue;}else{ UC=' '; } }
 
         fsc = tfntFetchCharacterW(UC, Flags&LA_TEXT_MONO);