mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	1. temp fix for Korean font
2. fix crashes when cjk language is use but the system don't have unicode support enabled on Windows
This commit is contained in:
		
							parent
							
								
									b5cbb42e62
								
							
						
					
					
						commit
						f5b824eaa2
					
				
					 9 changed files with 104 additions and 3 deletions
				
			
		|  | @ -2079,7 +2079,15 @@ void ImGuiWrapper::init_font(bool compress) | |||
|     cfg.OversampleH = cfg.OversampleV = 1; | ||||
|     //FIXME replace with io.Fonts->AddFontFromMemoryTTF(buf_decompressed_data, (int)buf_decompressed_size, m_font_size, nullptr, ranges.Data);
 | ||||
|     //https://github.com/ocornut/imgui/issues/220
 | ||||
|     default_font = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/" + "HarmonyOS_Sans_SC_Regular.ttf").c_str(), m_font_size, &cfg, m_font_cjk ? ImGui::GetIO().Fonts->GetGlyphRangesChineseFull() : ranges.Data); | ||||
| 
 | ||||
|     // Orca: temp fix for Korean font
 | ||||
|     auto font_name_regular = "HarmonyOS_Sans_SC_Regular.ttf"; | ||||
|     auto font_name_bold = "HarmonyOS_Sans_SC_Bold.ttf"; | ||||
|     if(m_glyph_ranges == ImGui::GetIO().Fonts->GetGlyphRangesKorean()) { | ||||
|         font_name_regular = "NotoSansKR-Regular.otf"; | ||||
|         font_name_bold = "NotoSansKR-Bold.otf"; | ||||
|     } | ||||
|     default_font = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/" + font_name_regular).c_str(), m_font_size, &cfg, ranges.Data); | ||||
|     if (default_font == nullptr) { | ||||
|         default_font = io.Fonts->AddFontDefault(); | ||||
|         if (default_font == nullptr) { | ||||
|  | @ -2087,7 +2095,7 @@ void ImGuiWrapper::init_font(bool compress) | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     bold_font        = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/" + "HarmonyOS_Sans_SC_Bold.ttf").c_str(), m_font_size, &cfg, ranges.Data); | ||||
|     bold_font        = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/" + font_name_bold).c_str(), m_font_size, &cfg, ranges.Data); | ||||
|     if (bold_font == nullptr) { | ||||
|         bold_font = io.Fonts->AddFontDefault(); | ||||
|         if (bold_font == nullptr) { throw Slic3r::RuntimeError("ImGui: Could not load deafult font"); } | ||||
|  |  | |||
|  | @ -1577,7 +1577,7 @@ void PartPlate::generate_plate_name_texture() | |||
| 	auto* font = &Label::Head_32; | ||||
| 
 | ||||
| 	wxColour foreground(0xf2, 0x75, 0x4e, 0xff); | ||||
|     if (!m_name_texture.generate_from_text_string(text.ToStdString(), *font, *wxBLACK, foreground)) | ||||
|     if (!m_name_texture.generate_from_text_string(text.ToUTF8().data(), *font, *wxBLACK, foreground)) | ||||
| 		BOOST_LOG_TRIVIAL(error) << "PartPlate::generate_plate_name_texture(): generate_from_text_string() failed"; | ||||
|     auto bed_ext = get_extents(m_shape); | ||||
|     auto factor = bed_ext.size()(1) / 200.0; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 SoftFever
						SoftFever