@@ -181,14 +181,13 @@ bool CSkinFile::LoadFromXml(const wstring& file_path)
181181 {
182182 m_skin_info.text_color .push_back (atoi (str.c_str ()));
183183 }
184- }
185-
186- if (m_skin_info.text_color .size () < theApp.m_plugins .AllDisplayItemsWithPlugins ().size ())
187- {
188- COLORREF default_color{};
189- if (!m_skin_info.text_color .empty ())
190- default_color = m_skin_info.text_color .front ();
191- m_skin_info.text_color .resize (theApp.m_plugins .AllDisplayItemsWithPlugins ().size (), default_color);
184+ if (m_skin_info.text_color .size () < theApp.m_plugins .AllDisplayItemsWithPlugins ().size ())
185+ {
186+ COLORREF default_color{};
187+ if (!m_skin_info.text_color .empty ())
188+ default_color = m_skin_info.text_color .front ();
189+ m_skin_info.text_color .resize (theApp.m_plugins .AllDisplayItemsWithPlugins ().size (), default_color);
190+ }
192191 }
193192 // 指定每个项目的颜色
194193 else if (skin_item_name == " specify_each_item_color" )
@@ -203,7 +202,7 @@ bool CSkinFile::LoadFromXml(const wstring& file_path)
203202 // 字体
204203 else if (skin_item_name == " font" )
205204 {
206- m_skin_info.font_info .name = CTinyXml2Helper::ElementAttribute (skin_item, " name" );
205+ m_skin_info.font_info .name = CCommon::StrToUnicode ( CTinyXml2Helper::ElementAttribute (skin_item, " name" ), true ). c_str ( );
207206 m_skin_info.font_info .size = atoi (CTinyXml2Helper::ElementAttribute (skin_item, " size" ));
208207 int font_style = atoi (CTinyXml2Helper::ElementAttribute (skin_item, " style" ));
209208 m_skin_info.font_info .bold = CCommon::GetNumberBit (font_style, 0 );
@@ -480,18 +479,22 @@ void CSkinFile::DrawPreview(CDC* pDC, CRect rect)
480479 }
481480
482481 // 绘制预览图文本
483- auto drawPreviewText = [&](Layout& layout, const PreviewInfo::Pos& pos) {
482+ auto drawPreviewText = [&](const Layout& layout, const PreviewInfo::Pos& pos) {
484483 for (auto iter = map_str.begin (); iter != map_str.end (); ++iter)
485484 {
486- if (layout.layout_items [iter->first ].show )
485+ auto layout_iter = layout.layout_items .find (iter->first );
486+ if (layout_iter == layout.layout_items .end ())
487+ continue ;
488+ auto layout_item = layout_iter->second ;
489+ if (layout_item.show )
487490 {
488491 CPoint point;
489- point.SetPoint (layout. layout_items [iter-> first ]. x , layout. layout_items [iter-> first ] .y );
492+ point.SetPoint (layout_item. x , layout_item .y );
490493 point.Offset (pos.x , pos.y );
491- CRect rect (point, CSize (layout. layout_items [iter-> first ] .width , m_layout_info.text_height ));
494+ CRect rect (point, CSize (layout_item .width , m_layout_info.text_height ));
492495 COLORREF text_color{};
493496 text_color = text_colors[iter->first ];
494- DrawSkinText (draw, iter->second , rect, text_color, layout. layout_items [iter-> first ] .align );
497+ DrawSkinText (draw, iter->second , rect, text_color, layout_item .align );
495498 }
496499 }
497500
0 commit comments