@@ -33,11 +33,17 @@ export class WebPubPreferencesEditor implements IPreferencesEditor {
3333 this . preferences [ key ] = value ;
3434 }
3535
36+ private get isDisplayTransformable ( ) : boolean {
37+ return this . metadata ?. accessibility ?. feature ?. some (
38+ f => f . value === Feature . DISPLAY_TRANSFORMABILITY . value
39+ ) ?? false ; // Default to false if no metadata
40+ }
41+
3642 get fontFamily ( ) : Preference < string > {
3743 return new Preference < string > ( {
3844 initialValue : this . preferences . fontFamily ,
3945 effectiveValue : this . settings . fontFamily || null ,
40- isEffective : this . metadata ?. accessibility ?. feature ?. includes ( Feature . DISPLAY_TRANSFORMABILITY ) ?? false ,
46+ isEffective : this . isDisplayTransformable ,
4147 onChange : ( newValue : string | null | undefined ) => {
4248 this . updatePreference ( "fontFamily" , newValue || null ) ;
4349 }
@@ -48,7 +54,7 @@ export class WebPubPreferencesEditor implements IPreferencesEditor {
4854 return new RangePreference < number > ( {
4955 initialValue : this . preferences . fontWeight ,
5056 effectiveValue : this . settings . fontWeight || 400 ,
51- isEffective : this . metadata ?. accessibility ?. feature ?. includes ( Feature . DISPLAY_TRANSFORMABILITY ) ?? false ,
57+ isEffective : this . isDisplayTransformable ,
5258 onChange : ( newValue : number | null | undefined ) => {
5359 this . updatePreference ( "fontWeight" , newValue || null ) ;
5460 } ,
@@ -61,7 +67,7 @@ export class WebPubPreferencesEditor implements IPreferencesEditor {
6167 return new BooleanPreference ( {
6268 initialValue : this . preferences . hyphens ,
6369 effectiveValue : this . settings . hyphens || false ,
64- isEffective : this . metadata ?. accessibility ?. feature ?. includes ( Feature . DISPLAY_TRANSFORMABILITY ) ?? false ,
70+ isEffective : this . isDisplayTransformable ,
6571 onChange : ( newValue : boolean | null | undefined ) => {
6672 this . updatePreference ( "hyphens" , newValue || null ) ;
6773 }
@@ -72,7 +78,7 @@ export class WebPubPreferencesEditor implements IPreferencesEditor {
7278 return new RangePreference < number > ( {
7379 initialValue : this . preferences . letterSpacing ,
7480 effectiveValue : this . settings . letterSpacing || 0 ,
75- isEffective : this . metadata ?. accessibility ?. feature ?. includes ( Feature . DISPLAY_TRANSFORMABILITY ) ?? false ,
81+ isEffective : this . isDisplayTransformable ,
7682 onChange : ( newValue : number | null | undefined ) => {
7783 this . updatePreference ( "letterSpacing" , newValue || null ) ;
7884 } ,
@@ -85,7 +91,7 @@ export class WebPubPreferencesEditor implements IPreferencesEditor {
8591 return new BooleanPreference ( {
8692 initialValue : this . preferences . ligatures ,
8793 effectiveValue : this . settings . ligatures || true ,
88- isEffective : this . metadata ?. accessibility ?. feature ?. includes ( Feature . DISPLAY_TRANSFORMABILITY ) ?? false ,
94+ isEffective : this . isDisplayTransformable ,
8995 onChange : ( newValue : boolean | null | undefined ) => {
9096 this . updatePreference ( "ligatures" , newValue || null ) ;
9197 }
@@ -96,7 +102,7 @@ export class WebPubPreferencesEditor implements IPreferencesEditor {
96102 return new RangePreference < number > ( {
97103 initialValue : this . preferences . lineHeight ,
98104 effectiveValue : this . settings . lineHeight ,
99- isEffective : this . metadata ?. accessibility ?. feature ?. includes ( Feature . DISPLAY_TRANSFORMABILITY ) ?? false ,
105+ isEffective : this . isDisplayTransformable ,
100106 onChange : ( newValue : number | null | undefined ) => {
101107 this . updatePreference ( "lineHeight" , newValue || null ) ;
102108 } ,
@@ -109,7 +115,7 @@ export class WebPubPreferencesEditor implements IPreferencesEditor {
109115 return new BooleanPreference ( {
110116 initialValue : this . preferences . noRuby ,
111117 effectiveValue : this . settings . noRuby || false ,
112- isEffective : this . metadata ?. accessibility ?. feature ?. includes ( Feature . DISPLAY_TRANSFORMABILITY ) ?? false ,
118+ isEffective : this . isDisplayTransformable ,
113119 onChange : ( newValue : boolean | null | undefined ) => {
114120 this . updatePreference ( "noRuby" , newValue || null ) ;
115121 }
@@ -120,7 +126,7 @@ export class WebPubPreferencesEditor implements IPreferencesEditor {
120126 return new RangePreference < number > ( {
121127 initialValue : this . preferences . paragraphIndent ,
122128 effectiveValue : this . settings . paragraphIndent || 0 ,
123- isEffective : this . metadata ?. accessibility ?. feature ?. includes ( Feature . DISPLAY_TRANSFORMABILITY ) ?? false ,
129+ isEffective : this . isDisplayTransformable ,
124130 onChange : ( newValue : number | null | undefined ) => {
125131 this . updatePreference ( "paragraphIndent" , newValue || null ) ;
126132 } ,
@@ -133,7 +139,7 @@ export class WebPubPreferencesEditor implements IPreferencesEditor {
133139 return new RangePreference < number > ( {
134140 initialValue : this . preferences . paragraphSpacing ,
135141 effectiveValue : this . settings . paragraphSpacing || 0 ,
136- isEffective : this . metadata ?. accessibility ?. feature ?. includes ( Feature . DISPLAY_TRANSFORMABILITY ) ?? false ,
142+ isEffective : this . isDisplayTransformable ,
137143 onChange : ( newValue : number | null | undefined ) => {
138144 this . updatePreference ( "paragraphSpacing" , newValue || null ) ;
139145 } ,
@@ -146,7 +152,7 @@ export class WebPubPreferencesEditor implements IPreferencesEditor {
146152 return new EnumPreference < TextAlignment > ( {
147153 initialValue : this . preferences . textAlign ,
148154 effectiveValue : this . settings . textAlign || TextAlignment . start ,
149- isEffective : this . metadata ?. accessibility ?. feature ?. includes ( Feature . DISPLAY_TRANSFORMABILITY ) ?? false ,
155+ isEffective : this . isDisplayTransformable ,
150156 onChange : ( newValue : TextAlignment | null | undefined ) => {
151157 this . updatePreference ( "textAlign" , newValue || null ) ;
152158 } ,
@@ -158,7 +164,7 @@ export class WebPubPreferencesEditor implements IPreferencesEditor {
158164 return new BooleanPreference ( {
159165 initialValue : this . preferences . textNormalization ,
160166 effectiveValue : this . settings . textNormalization || false ,
161- isEffective : this . metadata ?. accessibility ?. feature ?. includes ( Feature . DISPLAY_TRANSFORMABILITY ) ?? false ,
167+ isEffective : this . isDisplayTransformable ,
162168 onChange : ( newValue : boolean | null | undefined ) => {
163169 this . updatePreference ( "textNormalization" , newValue || null ) ;
164170 }
@@ -169,7 +175,7 @@ export class WebPubPreferencesEditor implements IPreferencesEditor {
169175 return new RangePreference < number > ( {
170176 initialValue : this . preferences . wordSpacing ,
171177 effectiveValue : this . settings . wordSpacing || 0 ,
172- isEffective : this . metadata ?. accessibility ?. feature ?. includes ( Feature . DISPLAY_TRANSFORMABILITY ) ?? false ,
178+ isEffective : this . isDisplayTransformable ,
173179 onChange : ( newValue : number | null | undefined ) => {
174180 this . updatePreference ( "wordSpacing" , newValue || null ) ;
175181 } ,
0 commit comments