mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 05:01:05 +01:00 
			
		
		
		
	Version number and font documentation
This commit is contained in:
		| @@ -63,7 +63,8 @@ Credits | ||||
|  | ||||
| Developed by [Omar Cornut](http://www.miracleworld.net). The library was developed with the support of [Media Molecule](http://www.mediamolecule.com) and first used internally on the game [Tearaway](http://tearaway.mediamolecule.com).  | ||||
|  | ||||
| Embeds [proggy_clean](http://upperbounds.net) font by Tristan Grimmer (also MIT license). | ||||
| Embeds [proggy_clean](http://upperbounds.net) font by Tristan Grimmer (MIT license). | ||||
| Embeds [M+ fonts](http://mplus-fonts.sourceforge.jp/mplus-outline-fonts/index-en.html) font by Coji Morishita (free software license). | ||||
|  | ||||
| Inspiration, feedback, and testing: Casey Muratori, Atman Binstock, Mikko Mononen, Emmanuel Briney, Stefan Kamoda, Anton Mikhailov, Matt Willis. Thanks! | ||||
|  | ||||
|   | ||||
| @@ -10,12 +10,22 @@ bmfont reads fonts (.ttf, .fon, etc.) and output a .fnt file and a texture file, | ||||
|   proggy_clean.fon --> [bmfont] ---> proggy_clean_13.fnt | ||||
|                                      proggy_clean_13.png | ||||
|  | ||||
| If you need a free font that supports chinese/japanese characters, you can use the M+ fonts. | ||||
| TTF and sources are availables at http://mplus-fonts.sourceforge.jp/mplus-outline-fonts. | ||||
| This directory include some of the M+ fonts converted by bmfont. | ||||
|  | ||||
| //----------------------------------------------------------------------------- | ||||
|  | ||||
| Configure bmfont: | ||||
|  | ||||
|   - Export .fnt as Binary | ||||
|   - Output .png, 32-bits (or whatever is suitable for your loader/renderer) | ||||
|   - Tip: uncheck "Render from TrueType outline" and "Font Smoothing" for best result with non-anti-aliased type fonts.  | ||||
|     But you can experiment with other settings if you want anti-aliased fonts. | ||||
|   - Tip: use pngout.exe (http://advsys.net/ken/utils.htm) to further reduce the file size of .png files | ||||
|     All files in this folder have been optimised with pngout.exe | ||||
|  | ||||
| ----------------------------------------------------------------------------- | ||||
|  | ||||
| (A) Use font data embedded in ImGui | ||||
|  | ||||
| @@ -34,28 +44,45 @@ Configure bmfont: | ||||
|      | ||||
|   2. Load the .PNG data from 'png_data' into a texture | ||||
|  | ||||
|  | ||||
| //----------------------------------------------------------------------------- | ||||
|  | ||||
| (B) Use fonts from external files | ||||
|  | ||||
|     ImGuiIO& io = ImGui::GetIO(); | ||||
|   You need to set io.FontTexUvForWhite to UV coordinates pointing to a white pixel in the texture. | ||||
|   You can either locate a white pixel manually or use code at runtime to find or write one. | ||||
|   The OpenGL example include sample code to find a white pixel given an uncompressed 32-bits texture: | ||||
|  | ||||
|   	  // Automatically find white pixel from the texture we just loaded | ||||
| 	  // (io.FontTexUvForWhite needs to contains UV coordinates pointing to a white pixel in order to render solid objects) | ||||
| 	  for (int tex_data_off = 0; tex_data_off < tex_x*tex_y; tex_data_off++) | ||||
| 	      if (((unsigned int*)tex_data)[tex_data_off] == 0xffffffff) | ||||
| 	      { | ||||
| 	          io.FontTexUvForWhite = ImVec2((float)(tex_data_off % tex_x)/(tex_x), (float)(tex_data_off / tex_x)/(tex_y)); | ||||
| 	          break; | ||||
| 	      } | ||||
|  | ||||
|   1. Load the .FNT data, e.g. | ||||
|  | ||||
|     ImGuiIO& io = ImGui::GetIO(); | ||||
|      | ||||
|     // proggy_clean_13 [default] | ||||
|     io.Font = new ImBitmapFont(); | ||||
|     io.Font->LoadFromFile("proggy_clean_13.fnt"); | ||||
|     IM_ASSERT(io.Font->IsLoaded()); | ||||
|     io.FontTexUvForWhite = ImVec2(0.0f/256.0f,0.0f/128); | ||||
|     io.FontYOffset = +1; | ||||
|  | ||||
|     // proggy_small_12 | ||||
|     io.Font = new ImBitmapFont(); | ||||
|     io.Font->LoadFromFile("proggy_small_12.fnt"); | ||||
|     IM_ASSERT(io.Font->IsLoaded()); | ||||
|     io.FontTexUvForWhite = ImVec2(84.0f/256.0f,20.0f/64); | ||||
|     io.FontYOffset = +2; | ||||
|      | ||||
|     // proggy_small_14 | ||||
|     io.Font = new ImBitmapFont(); | ||||
|     io.Font->LoadFromFile("proggy_small_14.fnt"); | ||||
|     IM_ASSERT(io.Font->IsLoaded()); | ||||
|     io.FontTexUvForWhite = ImVec2(84.0f/256.0f,20.0f/64); | ||||
|     io.FontYOffset = +3; | ||||
|      | ||||
| @@ -67,5 +94,7 @@ Configure bmfont: | ||||
|     io.Font->LoadFromFile("courier_new_18.fnt"); | ||||
|     io.FontTexUvForWhite = ImVec2(4.0f/256.0f,5.0f/256); | ||||
|  | ||||
|  | ||||
|   2. Load the matching .PNG data into a texture | ||||
|  | ||||
| //----------------------------------------------------------------------------- | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| // ImGui library v1.12+ | ||||
| // ImGui library v1.13 | ||||
| // See ImGui::ShowTestWindow() for sample code. | ||||
| // Read 'Programmer guide' below for notes on how to setup ImGui in your codebase. | ||||
| // Get latest version at https://github.com/ocornut/imgui | ||||
| @@ -22,7 +22,6 @@ | ||||
|  Designed for developers and content-creators, not the typical end-user! Some of the weaknesses includes: | ||||
|  - doesn't look fancy, doesn't animate | ||||
|  - limited layout features, intricate layouts are typically crafted in code | ||||
|  - assume ASCII text, using strlen() and [] operators, etc | ||||
|  - occasionally use statically sized buffers for string manipulations - won't crash, but some long text may be clipped | ||||
|   | ||||
|  END-USER GUIDE | ||||
|   | ||||
		Reference in New Issue
	
	Block a user