@@ -70,6 +70,14 @@ struct PluginAnnotation {
7070 }
7171};
7272
73+ struct FontWeightAnnotation {
74+ bool skipDescription () { return false ; }
75+ bool skipSave () { return false ; }
76+ void dumpDescription (RawConfig &config) {
77+ config.setValueByPath (" FontWeight" , " True" );
78+ }
79+ };
80+
7381FCITX_CONFIGURATION (
7482 BasicConfig,
7583 Option<bool > followCaret{this , " FollowCaret" , _ (" Follow caret" ), false };
@@ -266,39 +274,41 @@ FCITX_CONFIGURATION(
266274
267275using FontFamilyOption =
268276 OptionWithAnnotation<std::vector<std::string>, FontAnnotation>;
277+ using FontWeightOption =
278+ Option<int , IntConstrain, DefaultMarshaller<int >, FontWeightAnnotation>;
269279
270280FCITX_CONFIGURATION (
271281 FontConfig,
272282 FontFamilyOption textFontFamily{
273283 this , " TextFontFamily" , _ (" Text font family" ), {" " }};
274284 Option<int , IntConstrain> textFontSize{
275285 this , " TextFontSize" , _ (" Text font size" ), 16 , IntConstrain (4 , 100 )};
276- Option< int , IntConstrain> textFontWeight{this , " TextFontWeight" ,
277- _ (" Text font weight" ), 400 ,
278- IntConstrain (1 , 1000 )};
286+ FontWeightOption textFontWeight{this , " TextFontWeight" ,
287+ _ (" Text font weight" ), 400 ,
288+ IntConstrain (1 , 1000 )};
279289 FontFamilyOption labelFontFamily{
280290 this , " LabelFontFamily" , _ (" Label font family" ), {" " }};
281291 Option<int , IntConstrain> labelFontSize{
282292 this , " LabelFontSize" , _ (" Label font size" ), 12 , IntConstrain (4 , 100 )};
283- Option< int , IntConstrain> labelFontWeight{this , " LabelFontWeight" ,
284- _ (" Label font weight" ), 400 ,
285- IntConstrain (1 , 1000 )};
293+ FontWeightOption labelFontWeight{this , " LabelFontWeight" ,
294+ _ (" Label font weight" ), 400 ,
295+ IntConstrain (1 , 1000 )};
286296 FontFamilyOption commentFontFamily{
287297 this , " CommentFontFamily" , _ (" Comment font family" ), {" " }};
288298 Option<int , IntConstrain> commentFontSize{this , " CommentFontSize" ,
289299 _ (" Comment font size" ), 12 ,
290300 IntConstrain (4 , 100 )};
291- Option< int , IntConstrain> commentFontWeight{this , " CommentFontWeight" ,
292- _ (" Comment font weight" ), 400 ,
293- IntConstrain (1 , 1000 )};
301+ FontWeightOption commentFontWeight{this , " CommentFontWeight" ,
302+ _ (" Comment font weight" ), 400 ,
303+ IntConstrain (1 , 1000 )};
294304 FontFamilyOption preeditFontFamily{
295305 this , " PreeditFontFamily" , _ (" Preedit font family" ), {" " }};
296306 Option<int , IntConstrain> preeditFontSize{this , " PreeditFontSize" ,
297307 _ (" Preedit font size" ), 16 ,
298308 IntConstrain (4 , 100 )};
299- Option< int , IntConstrain> preeditFontWeight{this , " PreeditFontWeight" ,
300- _ (" Preedit font weight" ), 400 ,
301- IntConstrain (1 , 1000 )};
309+ FontWeightOption preeditFontWeight{this , " PreeditFontWeight" ,
310+ _ (" Preedit font weight" ), 400 ,
311+ IntConstrain (1 , 1000 )};
302312 ExternalOption userFontDir{this , " UserFontDir" , _ (" User font dir" ), " " };
303313 ExternalOption systemFontDir{this , " SystemFontDir" , _ (" System font dir" ),
304314 " " };);
0 commit comments