+ y1 += av.charHeight - av.charHeight / 5; // height/5 replaces pady\r
+ int charOffset = 0;\r
+ char s;\r
+\r
+ if(end+1>=seq.getLength())\r
+ end = seq.getLength()-1;\r
+ graphics.setColor(av.textColour);\r
+\r
+\r
+ if(monospacedFont\r
+ && av.showText\r
+ && allGroups.length==0\r
+ && !av.getColourText()\r
+ && av.thresholdTextColour==0)\r
+ {\r
+ if(av.renderGaps)\r
+ graphics.drawString(seq.getSequence(start, end + 1), 0, y1);\r
+ else\r
+ {\r
+ char gap = av.getGapCharacter();\r
+ graphics.drawString( seq.getSequence(start, end+1).replace(gap, ' '), 0, y1);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ boolean getboxColour = false;\r
+ for (int i = start; i <= end; i++)\r
+ {\r
+ graphics.setColor(av.textColour);\r
+ getboxColour = false;\r
+ s = seq.getCharAt(i);\r
+ if (!renderGaps && jalview.util.Comparison.isGap(s))\r
+ {\r
+ continue;\r
+ }\r
+\r
+ if (inCurrentSequenceGroup(i))\r
+ {\r
+ if (!currentSequenceGroup.getDisplayText())\r
+ {\r
+ continue;\r
+ }\r
+\r
+ if (currentSequenceGroup.thresholdTextColour > 0\r
+ || currentSequenceGroup.getColourText())\r
+ {\r
+ getboxColour = true;\r
+ getBoxColour(currentSequenceGroup.cs, seq, i);\r
+\r
+ if (currentSequenceGroup.getColourText())\r
+ graphics.setColor(resBoxColour.darker());\r
+\r
+ if (currentSequenceGroup.thresholdTextColour > 0)\r
+ {\r
+ if (resBoxColour.getRed() +\r
+ resBoxColour.getBlue() +\r
+ resBoxColour.getGreen() < currentSequenceGroup.thresholdTextColour)\r
+ graphics.setColor(currentSequenceGroup.textColour2);\r
+ }\r
+ }\r
+ else\r
+ graphics.setColor(currentSequenceGroup.textColour);\r
+\r
+ }\r
+ else\r
+ {\r
+ if (!av.getShowText())\r
+ {\r
+ continue;\r
+ }\r
+\r
+ if (av.getColourText())\r
+ {\r
+ getboxColour = true;\r
+ getBoxColour(av.globalColourScheme, seq, i);\r
+\r
+ if (av.getShowBoxes())\r
+ {\r
+ graphics.setColor(resBoxColour.darker());\r
+ }\r
+ else\r
+ {\r
+ graphics.setColor(resBoxColour);\r
+ }\r
+ }\r
+\r
+ if (av.thresholdTextColour > 0)\r
+ {\r
+ if (!getboxColour)\r
+ getBoxColour(av.globalColourScheme, seq, i);\r
+\r
+ if (resBoxColour.getRed() +\r
+ resBoxColour.getBlue() +\r
+ resBoxColour.getGreen() < av.thresholdTextColour)\r
+ graphics.setColor(av.textColour2);\r
+ }\r
+\r
+ }\r
+\r
+\r
+\r
+ charOffset = (av.charWidth - fm.charWidth(s)) / 2;\r
+ graphics.drawString(String.valueOf(s),\r
+ charOffset + av.charWidth * (i - start),\r
+ y1);\r
+\r
+ }\r
+ }\r