mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 13:11:05 +01:00 
			
		
		
		
	Readme, FAQ tweaks (#1807)
This commit is contained in:
		
							
								
								
									
										11
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								imgui.cpp
									
									
									
									
									
								
							| @@ -706,11 +706,12 @@ | ||||
|     (such as CP-923 for Japanese or CP-1251 for Cyrillic) will NOT work! | ||||
|     Otherwise you can convert yourself to UTF-8 or load text data from file already saved as UTF-8. | ||||
|  | ||||
|     Text input: it is up to your application to pass the right character code by calling | ||||
|     io.AddInputCharacter(). The applications in examples/ are doing that. For languages relying | ||||
|     on an Input Method Editor (IME), on Windows you can copy the Hwnd of your application in the | ||||
|     io.ImeWindowHandle field. The default implementation of io.ImeSetInputScreenPosFn() will set | ||||
|     your Microsoft IME position correctly. | ||||
|     Text input: it is up to your application to pass the right character code by calling io.AddInputCharacter().  | ||||
|     The applications in examples/ are doing that.  | ||||
|     Windows: you can use the WM_CHAR or WM_UNICHAR or WM_IME_CHAR message (depending if your app is built using Unicode or MultiByte mode). | ||||
|     You may also use MultiByteToWideChar() or ToUnicode() to retrieve Unicode codepoints from MultiByte characters or keyboard state. | ||||
|     Windows: if your language is relying on an Input Method Editor (IME), you copy the HWND of your window to io.ImeWindowHandle in order for  | ||||
|     the default implementation of io.ImeSetInputScreenPosFn() to set your Microsoft IME position correctly. | ||||
|  | ||||
|  Q: How can I use the drawing facilities without an ImGui window? (using ImDrawList API) | ||||
|  A: - You can create a dummy window. Call SetNextWindowBgAlpha(0.0f), call Begin() with NoTitleBar|NoResize|NoMove|NoScrollbar|NoSavedSettings|NoInputs flags. | ||||
|   | ||||
| @@ -15,7 +15,6 @@ In this document: | ||||
| - Fonts Loading Instructions | ||||
| - FreeType rasterizer, Small font sizes | ||||
| - Building Custom Glyph Ranges | ||||
| - Remapping Codepoints | ||||
| - Embedding Fonts in Source Code | ||||
| - Credits/Licences for fonts included in this folder | ||||
| - Links, Other fonts | ||||
| @@ -27,7 +26,9 @@ In this document: | ||||
|  | ||||
|  - You can use the style editor ImGui::ShowStyleEditor() to browse your fonts and understand what's going on if you have an issue. | ||||
|  - Make sure your font ranges data are persistent (available during the call to GetTexDataAsAlpha8()/GetTexDataAsRGBA32()/Build(). | ||||
|  - Use C++11 u8"my text" syntax to encode literal strings as UTF-8.  | ||||
|  - Use C++11 u8"my text" syntax to encode literal strings as UTF-8. e.g.: | ||||
|        u8"hello" | ||||
|        u8"こんにちは"   // this will be encoded as UTF-8 | ||||
|  - If you want to include a backslash \ character in your string literal, you need to double them e.g. "folder\\filename". | ||||
|  | ||||
|  | ||||
| @@ -122,12 +123,13 @@ In this document: | ||||
|    // Basic Latin, Extended Latin | ||||
|    io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels, NULL, io.Fonts->GetGlyphRangesDefault()); | ||||
|     | ||||
|    // Include full set of about 21000 CJK Unified Ideographs | ||||
|    io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels, NULL, io.Fonts->GetGlyphRangesJapanese()); | ||||
|    // Default + Selection of 2500 Ideographs used by Simplified Chinese | ||||
|    io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels, NULL, io.Fonts->GetGlyphRangesChineseSimplifiedCommon()); | ||||
|     | ||||
|    // Default + Hiragana, Katakana, Half-Width, Selection of 1946 Ideographs | ||||
|    io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels, NULL, io.Fonts->GetGlyphRangesChinese()); | ||||
|    io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels, NULL, io.Fonts->GetGlyphRangesJapanese()); | ||||
|  | ||||
|  See "BUILDING CUSTOM GLYPH RANGES" section to create your own ranges.  | ||||
|  Offset font vertically by altering the io.Font->DisplayOffset value: | ||||
|  | ||||
|    ImFont* font = io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels); | ||||
| @@ -162,18 +164,6 @@ In this document: | ||||
|    io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_in_pixels, NULL, ranges.Data); | ||||
|  | ||||
|  | ||||
| --------------------------------------- | ||||
|  REMAPPING CODEPOINTS | ||||
| --------------------------------------- | ||||
|  | ||||
|  All your strings needs to use UTF-8 encoding. Specifying literal in your source code using a local code page (such as CP-923 for Japanese, or CP-1251 for Cyrillic) will NOT work! | ||||
|  In C++11 you can encode a string literal in UTF-8 by using the u8"hello" syntax. Otherwise you can convert yourself to UTF-8 or load text data from file already saved as UTF-8. | ||||
|  e.g. | ||||
|       u8"hello" | ||||
|       u8"こんにちは" | ||||
|  You may also try to remap your local codepage characters to their Unicode codepoint using font->AddRemapChar(), but international users may have problems reading/editing your source code. | ||||
|  | ||||
|  | ||||
| --------------------------------------- | ||||
|  EMBEDDING FONTS IN SOURCE CODE | ||||
| --------------------------------------- | ||||
|   | ||||
		Reference in New Issue
	
	Block a user