Check-in [d111441eed]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:fixed bug in draw-text/centered
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:d111441eedbacefa3a3e1855870553f93ada790a
User & Date: aldo 2016-09-06 09:52:50
Context
2016-09-06
09:53
ffixed bug in layout check-in: 8dd997b795 user: aldo tags: trunk
09:52
fixed bug in draw-text/centered check-in: d111441eed user: aldo tags: trunk
09:08
added remote-repl check-in: 0da0d1eefe user: aldo tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to draw.ss.

80
81
82
83
84
85
86




87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
  (define font-weight (mi-font-weight))
  (define color (mi-color))

  (check-arg string? text draw-text/centered)
  (check-arg number? x draw-text/centered)
  (check-arg number? y draw-text/centered)
  (let ([extents (cairo-text-extents-create)])




    (cairo-text-extents (mi-cr) text extents)
    (let-struct extents cairo-text-extents-t (width height x-bearing y-bearing)
		(draw!
		 (lambda ()
		   (cairo-set-font-size (mi-cr) font-size)
		   (cairo-select-font-face  (mi-cr) (string-append font-family (string #\nul))
					    (cairo-font-slant font-style) ;; normal|italic|oblique
					    (cairo-font-weight font-weight)) ;; normal|bold
		   
		   
					;		(printf "x ~d y ~d~n" x y)
		   (cairo-set-source-color (mi-cr) color)
		   (cairo-move-to (mi-cr) 
				  (- x (/ width 2) x-bearing)
				  (- y (/ height 2) y-bearing))
		   (cairo-show-text (mi-cr) text)))
		(list width height))))

(define (draw-box id class style)
  #t
  )







>
>
>
>









<



|







80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99

100
101
102
103
104
105
106
107
108
109
110
  (define font-weight (mi-font-weight))
  (define color (mi-color))

  (check-arg string? text draw-text/centered)
  (check-arg number? x draw-text/centered)
  (check-arg number? y draw-text/centered)
  (let ([extents (cairo-text-extents-create)])
    (cairo-set-font-size (mi-cr) font-size)
    (cairo-select-font-face  (mi-cr) (string-append font-family (string #\nul))
					    (cairo-font-slant font-style) ;; normal|italic|oblique
					    (cairo-font-weight font-weight)) ;; normal|bold
    (cairo-text-extents (mi-cr) text extents)
    (let-struct extents cairo-text-extents-t (width height x-bearing y-bearing)
		(draw!
		 (lambda ()
		   (cairo-set-font-size (mi-cr) font-size)
		   (cairo-select-font-face  (mi-cr) (string-append font-family (string #\nul))
					    (cairo-font-slant font-style) ;; normal|italic|oblique
					    (cairo-font-weight font-weight)) ;; normal|bold
		   

					;		(printf "x ~d y ~d~n" x y)
		   (cairo-set-source-color (mi-cr) color)
		   (cairo-move-to (mi-cr) 
				  (- x (/ width 2) x-bearing )
				  (- y (/ height 2) y-bearing))
		   (cairo-show-text (mi-cr) text)))
		(list width height))))

(define (draw-box id class style)
  #t
  )