unit FontStylesConversion; interface uses Graphics; implementation function FontStylesToInt(FontStyles: TFontStyles): ShortInt; var Res: ShortInt; begin Res := 0; if fsBold in FontStyles then Res := Res+1; if fsItalic in FontStyles then Res := Res+2; if fsUnderline in FontStyles then Res := Res+5; if fsStrikeOut in FontStyles then Res := Res+10; Result := Res; end; function IntToFontStyles(ShInt: ShortInt): TFontStyles; begin case ShInt of 0: Result := []; 1: Result := [fsBold]; 2: Result := [fsItalic]; 3: Result := [fsBold, fsItalic]; 5: Result := [fsUnderline]; 6: Result := [fsBold, fsUnderline]; 7: Result := [fsItalic, fsUnderline]; 8: Result := [fsBold, fsItalic, fsUnderline]; 10: Result := [fsStrikeOut]; 11: Result := [fsBold, fsStrikeOut]; 12: Result := [fsItalic, fsStrikeOut]; 13: Result := [fsBold, fsItalic, fsStrikeOut]; 15: Result := [fsUnderline, fsStrikeOut]; 16: Result := [fsBold, fsUnderline, fsStrikeOut]; 17: Result := [fsItalic, fsUnderline, fsStrikeOut]; 18: Result := [fsBold, fsItalic, fsUnderline, fsStrikeOut]; end; end; end.