From b656bd8bf496676c542b6e9569db918215475c30 Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Thu, 12 Oct 2006 21:51:19 +0000 Subject: [PATCH] better glyph offset computation my first attempt at computing an offset to better center the AGCTN ended up putting the links under the wrong basepair. Not only does this patch put the segment under the right basepair it also makes the glyphs a little bit wider. --- alg/glsequence.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/alg/glsequence.cpp b/alg/glsequence.cpp index 3a9df4d..6cb1b57 100644 --- a/alg/glsequence.cpp +++ b/alg/glsequence.cpp @@ -284,7 +284,7 @@ CP Xdata[] = {{ 0, 5, PT}, {5, -5,STROKE},{0,-5,PT},{5, 5, END}}; CP Ndata[] = {{ 0, -5, PT}, {0, 5, PT}, {5, -5, PT}, {5, 5, END}}; //! the maximum width used for a charcter glyph -const int max_glyph_width = 5; +const int max_glyph_width = 5; // unit ( glyph_coord ) static void drawLetter(CP *l, GLfloat z) { @@ -321,8 +321,11 @@ void GlSequence::draw_sequence(GLfloat left, GLfloat right) const Sequence::const_iterator seq_itor = sequence_begin(left, right); Sequence::const_iterator seq_end = sequence_end(left, right); Sequence::size_type basepair = 0; - const float glyph_x_scale = 0.1; - const float glyph_margin = ((1.0 / glyph_x_scale) - max_glyph_width) / 4.0; + const float bp_per_world = 1.0; //( world coord ) + const float glyph_x_scale = 0.125; // unit = ( world coord / glyph coord ) + // compute how much space there should be to either size of a letter + const float glyph_margin = (bp_per_world - glyph_x_scale * max_glyph_width) + / 2.0; assert(seq_end - seq_itor >= 0); while(seq_itor != seq_end) -- 2.30.2