<s> try : <EOL> from mojo . roboFont import CurrentFont , CurrentGlyph <EOL> except ImportError : <EOL> from robofab . world import CurrentFont , CurrentGlyph <EOL> from vanilla import * <EOL> from hTools2 import hDialog <EOL> from hTools2 . modules . fontutils import get_full_name <EOL> from hTools2 . modules . messages import no_font_open <EOL> class adjustVerticalMetrics ( hDialog ) : <EOL> """<STR_LIT>""" <EOL> ascender_min = <NUM_LIT:1> <EOL> capheight_min = <NUM_LIT:1> <EOL> xheight_min = <NUM_LIT:1> <EOL> descender_min = <NUM_LIT:1> <EOL> column_1 = <NUM_LIT> <EOL> column_2 = <NUM_LIT:200> <EOL> column_3 = <NUM_LIT> <EOL> moveX = <NUM_LIT:0> <EOL> moveY = <NUM_LIT:0> <EOL> def __init__ ( self ) : <EOL> self . title = "<STR_LIT>" <EOL> self . box_width = <NUM_LIT> <EOL> self . width = self . column_1 + self . column_2 + self . column_3 + ( self . padding_x * <NUM_LIT:3> ) + ( self . nudge_button * <NUM_LIT:4> ) + <NUM_LIT:2> <EOL> self . height = self . text_height + ( self . nudge_button * <NUM_LIT:4> ) + ( self . padding_y * <NUM_LIT:6> ) <EOL> self . font = CurrentFont ( ) <EOL> if self . font is not None : <EOL> self . w = FloatingWindow ( ( self . width , self . height ) , self . title ) <EOL> units_per_em = self . font . info . unitsPerEm <EOL> ascender = self . font . info . ascender <EOL> capheight = self . font . info . capHeight <EOL> xheight = self . font . info . xHeight <EOL> descender = abs ( self . font . info . descender ) <EOL> self . ascender_max = units_per_em <EOL> self . capheight_max = units_per_em <EOL> self . xheight_max = units_per_em <EOL> self . descender_max = units_per_em <EOL> x1 = self . padding_x <EOL> x2 = x1 + self . column_1 <EOL> x3 = x2 + self . column_2 + <NUM_LIT:15> <EOL> x4 = x3 + self . column_3 - <NUM_LIT:1> <EOL> x5 = x4 + self . nudge_button - <NUM_LIT:1> <EOL> x6 = x5 + self . nudge_button - <NUM_LIT:1> <EOL> x7 = x6 + self . nudge_button - <NUM_LIT:1> <EOL> y = self . padding_y <EOL> self . w . box = Box ( <EOL> ( x1 , y , <EOL> self . column_1 + self . column_2 , <EOL> self . text_height ) ) <EOL> self . w . box . text = TextBox ( <EOL> ( <NUM_LIT:5> , <NUM_LIT:0> , <EOL> - self . padding_x , <EOL> self . text_height ) , <EOL> get_full_name ( self . font ) , <EOL> sizeStyle = self . size_style ) <EOL> self . w . font_switch = SquareButton ( <EOL> ( x3 , y , <EOL> - self . padding_x , <EOL> self . text_height ) , <EOL> '<STR_LIT>' , <EOL> sizeStyle = self . size_style , <EOL> callback = self . update_font_callback ) <EOL> y += self . text_height + self . padding_y <EOL> self . w . ascender_label = TextBox ( <EOL> ( x1 , y , <EOL> self . column_1 , <EOL> self . nudge_button ) , <EOL> "<STR_LIT>" , <EOL> sizeStyle = self . size_style ) <EOL> self . w . ascender_slider = Slider ( <EOL> ( x2 , y - <NUM_LIT:5> , <EOL> self . column_2 , <EOL> self . nudge_button ) , <EOL> minValue = self . ascender_min , <EOL> maxValue = self . ascender_max , <EOL> value = ascender , <EOL> callback = self . ascender_slider_callback , <EOL> sizeStyle = self . size_style ) <EOL> self . w . ascender_value = EditText ( <EOL> ( x3 , y , <EOL> self . column_3 , <EOL> self . nudge_button ) , <EOL> ascender , <EOL> callback = self . ascender_value_callback , <EOL> sizeStyle = self . size_style , <EOL> readOnly = self . read_only ) <EOL> self . w . ascender_minus_01 = SquareButton ( <EOL> ( x4 , y , <EOL> self . nudge_button , <EOL> self . nudge_button ) , <EOL> '<STR_LIT:->' , <EOL> sizeStyle = self . size_style , <EOL> callback = self . ascender_minus_01_callback ) <EOL> self . w . ascender_plus_01 = SquareButton ( <EOL> ( x5 , y , <EOL> self . nudge_button , <EOL> self . nudge_button ) , <EOL> '<STR_LIT:+>' , <EOL> sizeStyle = self . size_style , <EOL> callback = self . ascender_plus_01_callback ) <EOL> self . w . ascender_minus_10 = SquareButton ( <EOL> ( x6 , y , <EOL> self . nudge_button , <EOL> self . nudge_button ) , <EOL> '<STR_LIT:->' , <EOL> sizeStyle = self . size_style , <EOL> callback = self . ascender_minus_10_callback ) <EOL> self . w . ascender_plus_10 = SquareButton ( <EOL> ( x7 , y , <EOL> self . nudge_button , <EOL> self . nudge_button ) , <EOL> '<STR_LIT:+>' , <EOL> sizeStyle = self . size_style , <EOL> callback = self . ascender_plus_10_callback ) <EOL> y += self . nudge_button + self . padding_y <EOL> self . w . capheight_label = TextBox ( <EOL> ( x1 , y , <EOL> self . column_1 , <EOL> self . nudge_button ) , <EOL> "<STR_LIT>" , <EOL> sizeStyle = self . size_style ) <EOL> self . w . capheight_slider = Slider ( <EOL> ( x2 , y - <NUM_LIT:5> , <EOL> self . column_2 , <EOL> self . nudge_button ) , <EOL> minValue = self . capheight_min , <EOL> maxValue = self . capheight_max , <EOL> value = capheight , <EOL> callback = self . capheight_slider_callback , <EOL> sizeStyle = self . size_style ) <EOL> self . w . capheight_value = EditText ( <EOL> ( x3 , y , <EOL> self . column_3 , <EOL> self . nudge_button ) , <EOL> capheight , <EOL> callback = self . capheight_value_callback , <EOL> sizeStyle = self . size_style , <EOL> readOnly = self . read_only ) <EOL> self . w . capheight_minus_01 = SquareButton ( <EOL> ( x4 , y , <EOL> self . nudge_button , <EOL> self . nudge_button ) , <EOL> '<STR_LIT:->' , <EOL> sizeStyle = self . size_style , <EOL> callback = self . capheight_minus_01_callback ) <EOL> self . w . capheight_plus_01 = SquareButton ( <EOL> ( x5 , y , <EOL> self . nudge_button , <EOL> self . nudge_button ) , <EOL> '<STR_LIT:+>' , <EOL> sizeStyle = self . size_style , <EOL> callback = self . capheight_plus_01_callback ) <EOL> self . w . capheight_minus_10 = SquareButton ( <EOL> ( x6 , y , <EOL> self . nudge_button , <EOL> self . nudge_button ) , <EOL> '<STR_LIT:->' , <EOL> sizeStyle = self . size_style , <EOL> callback = self . capheight_minus_10_callback ) <EOL> self . w . capheight_plus_10 = SquareButton ( <EOL> ( x7 , y , <EOL> self . nudge_button , <EOL> self . nudge_button ) , <EOL> '<STR_LIT:+>' , <EOL> sizeStyle = self . size_style , <EOL> callback = self . capheight_plus_10_callback ) <EOL> y += self . nudge_button + self . padding_y <EOL> self . w . xheight_label = TextBox ( <EOL> ( x1 , y , <EOL> self . column_1 , <EOL> self . nudge_button ) , <EOL> "<STR_LIT>" , <EOL> sizeStyle = self . size_style ) <EOL> self . w . xheight_slider = Slider ( <EOL> ( x2 , y - <NUM_LIT:5> , <EOL> self . column_2 , <EOL> self . nudge_button ) , <EOL> minValue = self . xheight_min , <EOL> maxValue = self . xheight_max , <EOL> value = xheight , <EOL> callback = self . xheight_slider_callback , <EOL> sizeStyle = self . size_style ) <EOL> self . w . xheight_value = EditText ( <EOL> ( x3 , y , <EOL> self . column_3 , <EOL> self . nudge_button ) , <EOL> xheight , <EOL> callback = self . xheight_value_callback , <EOL> sizeStyle = self . size_style , <EOL> readOnly = self . read_only ) <EOL> self . w . xheight_minus_01 = SquareButton ( <EOL> ( x4 , y , <EOL> self . nudge_button , <EOL> self . nudge_button ) , <EOL> '<STR_LIT:->' , <EOL> sizeStyle = self . size_style , <EOL> callback = self . xheight_minus_01_callback ) <EOL> self . w . xheight_plus_01 = SquareButton ( <EOL> ( x5 , y , <EOL> self . nudge_button , <EOL> self . nudge_button ) , <EOL> '<STR_LIT:+>' , <EOL> sizeStyle = self . size_style , <EOL> callback = self . xheight_plus_01_callback ) <EOL> self . w . xheight_minus_10 = SquareButton ( <EOL> ( x6 , y , <EOL> self . nudge_button , <EOL> self . nudge_button ) , <EOL> '<STR_LIT:->' , <EOL> sizeStyle = self . size_style , <EOL> callback = self . xheight_minus_10_callback ) <EOL> self . w . xheight_plus_10 = SquareButton ( <EOL> ( x7 , y , <EOL> self . nudge_button , <EOL> self . nudge_button ) , <EOL> '<STR_LIT:+>' , <EOL> sizeStyle = self . size_style , <EOL> callback = self . xheight_plus_10_callback ) <EOL> y += self . nudge_button + self . padding_y <EOL> self . w . descender_label = TextBox ( <EOL> ( x1 , y , <EOL> self . column_1 , <EOL> self . nudge_button ) , <EOL> "<STR_LIT>" , <EOL> sizeStyle = self . size_style ) <EOL> self . w . descender_slider = Slider ( <EOL> ( x2 , y - <NUM_LIT:5> , <EOL> self . column_2 , <EOL> self . nudge_button ) , <EOL> minValue = self . descender_min , <EOL> maxValue = self . descender_max , <EOL> value = descender , <EOL> callback = self . descender_slider_callback , <EOL> sizeStyle = self . size_style ) <EOL> self . w . descender_value = EditText ( <EOL> ( x3 , y , <EOL> self . column_3 , <EOL> self . nudge_button ) , <EOL> descender , <EOL> callback = self . descender_value_callback , <EOL> sizeStyle = self . size_style , <EOL> readOnly = self . read_only ) <EOL> self . w . descender_minus_01 = SquareButton ( <EOL> ( x4 , y , <EOL> self . nudge_button , <EOL> self . nudge_button ) , <EOL> '<STR_LIT:->' , <EOL> sizeStyle = self . size_style , <EOL> callback = self . descender_minus_01_callback ) <EOL> self . w . descender_plus_01 = SquareButton ( <EOL> ( x5 , y , <EOL> self . nudge_button , <EOL> self . nudge_button ) , <EOL> '<STR_LIT:+>' , <EOL> sizeStyle = self . size_style , <EOL> callback = self . descender_plus_01_callback ) <EOL> self . w . descender_minus_10 = SquareButton ( <EOL> ( x6 , y , <EOL> self . nudge_button , <EOL> self . nudge_button ) , <EOL> '<STR_LIT:->' , <EOL> sizeStyle = self . size_style , <EOL> callback = self . descender_minus_10_callback ) <EOL> self . w . descender_plus_10 = SquareButton ( <EOL> ( x7 , y , <EOL> self . nudge_button , <EOL> self . nudge_button ) , <EOL> '<STR_LIT:+>' , <EOL> sizeStyle = self . size_style , <EOL> callback = self . descender_plus_10_callback ) <EOL> self . w . open ( ) <EOL> else : <EOL> print no_font_open <EOL> def xheight_update ( self , value ) : <EOL> self . w . xheight_value . set ( value ) <EOL> self . w . xheight_slider . set ( value ) <EOL> self . font . info . xHeight = value <EOL> self . font . update ( ) <EOL> def capheight_update ( self , value ) : <EOL> self . w . capheight_value . set ( value ) <EOL> self . w . capheight_slider . set ( value ) <EOL> self . font . info . capHeight = value <EOL> self . font . update ( ) <EOL> def descender_update ( self , value ) : <EOL> self . w . descender_value . set ( abs ( value ) ) <EOL> self . w . descender_slider . set ( abs ( value ) ) <EOL> self . font . info . descender = - abs ( value ) <EOL> self . font . update ( ) <EOL> def ascender_update ( self , value ) : <EOL> self . w . ascender_value . set ( value ) <EOL> self . w . ascender_slider . set ( value ) <EOL> self . font . info . ascender = value <EOL> self . font . update ( ) <EOL> def update_font_callback ( self , sender ) : <EOL> self . font = CurrentFont ( ) <EOL> self . w . box . text . set ( get_full_name ( self . font ) ) <EOL> def xheight_minus_01_callback ( self , sender ) : <EOL> value = float ( self . w . xheight_value . get ( ) ) <EOL> value = int ( value ) - <NUM_LIT:1> <EOL> self . xheight_update ( value ) <EOL> def xheight_plus_01_callback ( self , sender ) : <EOL> value = float ( self . w . xheight_value . get ( ) ) <EOL> value = int ( value ) + <NUM_LIT:1> <EOL> self . xheight_update ( value ) <EOL> def xheight_minus_10_callback ( self , sender ) : <EOL> value = float ( self . w . xheight_value . get ( ) ) <EOL> value = int ( value ) - <NUM_LIT:10> <EOL> self . xheight_update ( value ) <EOL> def xheight_plus_10_callback ( self , sender ) : <EOL> value = float ( self . w . xheight_value . get ( ) ) <EOL> value = int ( value ) + <NUM_LIT:10> <EOL> self . xheight_update ( value ) <EOL> def capheight_minus_01_callback ( self , sender ) : <EOL> value = float ( self . w . capheight_value . get ( ) ) <EOL> value = int ( value ) - <NUM_LIT:1> <EOL> self . capheight_update ( value ) <EOL> def capheight_plus_01_callback ( self , sender ) : <EOL> value = float ( self . w . capheight_value . get ( ) ) <EOL> value = int ( value ) + <NUM_LIT:1> <EOL> self . capheight_update ( value ) <EOL> def capheight_minus_10_callback ( self , sender ) : <EOL> value = float ( self . w . capheight_value . get ( ) ) <EOL> value = int ( value ) - <NUM_LIT:10> <EOL> self . capheight_update ( value ) <EOL> def capheight_plus_10_callback ( self , sender ) : <EOL> value = float ( self . w . capheight_value . get ( ) ) <EOL> value = int ( value ) + <NUM_LIT:10> <EOL> self . capheight_update ( value ) <EOL> def ascender_minus_01_callback ( self , sender ) : <EOL> value = float ( self . w . ascender_value . get ( ) ) <EOL> value = int ( value ) - <NUM_LIT:1> <EOL> self . ascender_update ( value ) <EOL> def ascender_plus_01_callback ( self , sender ) : <EOL> value = float ( self . w . ascender_value . get ( ) ) <EOL> value = int ( value ) + <NUM_LIT:1> <EOL> self . ascender_update ( value ) <EOL> def ascender_minus_10_callback ( self , sender ) : <EOL> value = float ( self . w . ascender_value . get ( ) ) <EOL> value = int ( value ) - <NUM_LIT:10> <EOL> self . ascender_update ( value ) <EOL> def ascender_plus_10_callback ( self , sender ) : <EOL> value = float ( self . w . ascender_value . get ( ) ) <EOL> value = int ( value ) + <NUM_LIT:10> <EOL> self . ascender_update ( value ) <EOL> def descender_minus_01_callback ( self , sender ) : <EOL> value = float ( self . w . descender_value . get ( ) ) <EOL> value = abs ( int ( value ) ) - <NUM_LIT:1> <EOL> self . descender_update ( - value ) <EOL> def descender_plus_01_callback ( self , sender ) : <EOL> value = float ( self . w . descender_value . get ( ) ) <EOL> value = abs ( int ( value ) ) + <NUM_LIT:1> <EOL> self . descender_update ( - value ) <EOL> def descender_minus_10_callback ( self , sender ) : <EOL> value = float ( self . w . descender_value . get ( ) ) <EOL> value = abs ( int ( value ) ) - <NUM_LIT:10> <EOL> self . descender_update ( - value ) <EOL> def descender_plus_10_callback ( self , sender ) : <EOL> value = float ( self . w . descender_value . get ( ) ) <EOL> value = abs ( int ( value ) ) + <NUM_LIT:10> <EOL> self . descender_update ( - value ) <EOL> def xheight_slider_callback ( self , sender ) : <EOL> _xheight_value = int ( self . w . xheight_slider . get ( ) ) <EOL> self . w . xheight_value . set ( _xheight_value ) <EOL> self . font . info . xHeight = _xheight_value <EOL> self . font . update ( ) <EOL> def capheight_slider_callback ( self , sender ) : <EOL> _capheight_value = int ( self . w . capheight_slider . get ( ) ) <EOL> self . w . capheight_value . set ( _capheight_value ) <EOL> self . font . info . capHeight = _capheight_value <EOL> self . font . update ( ) <EOL> def descender_slider_callback ( self , sender ) : <EOL> _descender_value = int ( self . w . descender_slider . get ( ) ) <EOL> self . w . descender_value . set ( abs ( _descender_value ) ) <EOL> self . font . info . descender = - abs ( _descender_value ) <EOL> self . font . update ( ) <EOL> def ascender_slider_callback ( self , sender ) : <EOL> _ascender_value = int ( self . w . ascender_slider . get ( ) ) <EOL> self . w . ascender_value . set ( _ascender_value ) <EOL> self . font . info . ascender = _ascender_value <EOL> self . font . update ( ) <EOL> def xheight_value_callback ( self , sender ) : <EOL> _xheight_value = int ( sender . get ( ) ) <EOL> self . w . xheight_slider . set ( _xheight_value ) <EOL> self . font . info . xHeight = _xheight_value <EOL> self . font . update ( ) <EOL> def capheight_value_callback ( self , sender ) : <EOL> _capheight_value = int ( sender . get ( ) ) <EOL> self . w . capheight_slider . set ( _capheight_value ) <EOL> self . font . info . capHeight = _capheight_value <EOL> self . font . update ( ) <EOL> def ascender_value_callback ( self , sender ) : <EOL> _ascender_value = int ( sender . get ( ) ) <EOL> self . w . ascender_slider . set ( _ascender_value ) <EOL> self . font . info . ascender = _ascender_value <EOL> self . font . update ( ) <EOL> def descender_value_callback ( self , sender ) : <EOL> _descender_value = int ( sender . get ( ) ) <EOL> self . w . descender_slider . set ( _descender_value ) <EOL> self . font . info . descender = - _descender_value <EOL> self . font . update ( ) </s>
