Skip to content

Commit

Permalink
New
Browse files Browse the repository at this point in the history
  • Loading branch information
rmagick committed Apr 20, 2005
1 parent 24c9fdb commit 785d9c8
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 0 deletions.
19 changes: 19 additions & 0 deletions doc/ex/baseline_shift01.rb
@@ -0,0 +1,19 @@
require 'rvg/rvg'
include Magick

rvg = RVG.new(150, 100) do |canvas|
canvas.background_fill = 'white'
canvas.text(40, 35).styles(:font_weight=>'bold', :font_size=>28) do |txt|
txt.tspan('H')
txt.tspan('2').styles(:font_size=>20, :fill=>'red', :baseline_shift=>'sub')
txt.tspan('O')
end
canvas.text(40, 80).styles(:font_style=>'italic', :font_size=>28) do |txt|
txt.tspan('e=mc')
txt.tspan('2').styles(:font_size=>20, :fill=>'red', :baseline_shift=>'super')
end
canvas.rect(149, 99).styles(:fill=>'none', :stroke=>'blue')
end

rvg.draw.write('baseline_shift01.gif')

22 changes: 22 additions & 0 deletions doc/ex/text_styles.rb
@@ -0,0 +1,22 @@
#! /usr/local/bin/ruby -w
require 'rvg/rvg'
include Magick


rvg = RVG.new(200, 100) do |canvas|
canvas.background_fill = 'white'

canvas.g.styles(:font_size=>16) do |grp|
grp.text( 30, 30, ":text_anchor=>'start'").styles(:text_anchor=>'start')
grp.circle(1, 30, 30).styles(:stroke=>'red')
grp.text(100, 50, ":text_anchor=>'middle'").styles(:text_anchor=>'middle')
grp.circle(1, 100, 50).styles(:stroke=>'red')
grp.text(170, 70, ":text_anchor=>'end'").styles(:text_anchor=>'end')
grp.circle(1, 170, 70).styles(:stroke=>'red')
end

canvas.rect(199, 99).styles(:fill=>'none', :stroke=>'blue')
end

rvg.draw.write('text_styles.gif')

28 changes: 28 additions & 0 deletions doc/ex/writing_mode01.rb
@@ -0,0 +1,28 @@
require 'rvg/rvg'
include Magick

RVG.dpi = 90

TEXT_STYLES = {:writing_mode=>'tb',
:glyph_orientation_vertical=>0,
:fill=>'red4',
:font_weight=>'bold',
:font_size=>16}

TEXT_STYLES2 = {:writing_mode=>'tb',
:glyph_orientation_vertical=>90,
:fill=>'green',
:font_weight=>'bold',
:font_size=>16}

rvg = RVG.new(1.25.in, 6.in).viewbox(0,0,125,600) do |canvas|
canvas.background_fill = 'white'

canvas.text(40, 15, ":glyph_orientation_vertical=0").styles(TEXT_STYLES)
canvas.text(80, 25, ":glyph_orientation_vertical=90").styles(TEXT_STYLES2)

canvas.rect(124, 598).styles(:fill=>'none',:stroke=>'blue')
end

rvg.draw.write('writing_mode01.gif')

27 changes: 27 additions & 0 deletions doc/ex/writing_mode02.rb
@@ -0,0 +1,27 @@
require 'rvg/rvg'
include Magick

RVG.dpi = 90

TEXT_STYLES = {:writing_mode=>'lr',
:glyph_orientation_horizontal=>0,
:fill=>'red4',
:font_weight=>'bold',
:font_size=>16}

TEXT_STYLES2 = {:writing_mode=>'lr',
:glyph_orientation_horizontal=>180,
:fill=>'green',
:font_weight=>'bold',
:font_size=>16}

rvg = RVG.new(3.in, 1.in).viewbox(0,0,300,100) do |canvas|
canvas.background_fill = 'white'

canvas.text(15, 40, ":glyph_orientation_horizontal=0").styles(TEXT_STYLES)
canvas.text(15, 80, ":glyph_orientation_horizontal=180").styles(TEXT_STYLES2)

canvas.rect(299, 99).styles(:fill=>'none',:stroke=>'blue')
end

rvg.draw.write('writing_mode02.gif')

0 comments on commit 785d9c8

Please sign in to comment.