Package com.ibm.richtext.textlayout.attributes

Examples of com.ibm.richtext.textlayout.attributes.AttributeMap


        int runStart = getRunStart();
        int rangeStart = getBeginIndex();
        Map initialStyle = getAttributes();
       
        while (runStart > rangeStart) {
            AttributeMap style = fText.characterStyleAt(runStart-1);
            if (!matcher.matches(initialStyle, style, query)) {
                return runStart;
            }
            runStart = fText.characterStyleStart(runStart-1);
        }
View Full Code Here


        int runLimit = getRunLimit();
        int rangeLimit = getEndIndex();
        Map initialStyle = getAttributes();
       
        while (runLimit < rangeLimit) {
            AttributeMap style = fText.characterStyleAt(runLimit);
            if (!matcher.matches(initialStyle, style, query)) {
                return runLimit;
            }
            runLimit = fText.characterStyleLimit(runLimit);
        }
View Full Code Here

            update(start);
        }

        private void update(int pos) {
            if (pos < fRunStart || pos >= fRunLimit) {
                AttributeMap style = AttributeMap.EMPTY_ATTRIBUTE_MAP;
                if (pos < fRangeStart) {
                    fRunLimit = fRangeStart;
                    fRunStart = Integer.MIN_VALUE;
                }
                else if (pos > fRangeLimit) {
                    fRunStart = fRangeLimit;
                    fRunLimit = Integer.MAX_VALUE;
                }
                else {
                    fRunStart = Math.max(fRangeStart, fText.characterStyleStart(pos));
                    fRunStart = Math.max(fRunStart, fText.paragraphStart(pos));
                   
                    fRunLimit = Math.min(fRangeLimit, fText.characterStyleLimit(pos));
                    fRunLimit = Math.min(fRunLimit, fText.paragraphLimit(pos));
                    if (fRunStart < fRunLimit) {
                        style = fText.paragraphStyleAt(pos);
                        style = style.addAttributes(fText.characterStyleAt(pos));
                    }
                }
                fStyle = fFontResolver.applyFont(style);
            }
        }
View Full Code Here

            if (iter.getRunLimit() != runLimit) {
                System.out.println(iter.getRunLimit() + "; " + runLimit);
                throw new Error("getRunLimit is wrong.");
            }

            AttributeMap style = text.characterStyleAt(runStart);

            while (iter.getIndex() < runLimit) {
                AttributeMap resolved = FONT_MAPPER.applyFont(style);
                if (!iter.getAttributes().equals(resolved)) {
                    throw new Error("Style is wrong.");
                }
                iter.next();
            }
View Full Code Here

        }
    }

    public void test() {

        AttributeMap bold = new AttributeMap(TextAttribute.WEIGHT,
                                             TextAttribute.WEIGHT_BOLD);
        MText text = new StyledText("Hello there!", AttributeMap.EMPTY_ATTRIBUTE_MAP);
        text.replace(2, 2, 'V', bold);

        MTextIterator iter = new MTextIterator(text, FONT_MAPPER, 0, text.length());
View Full Code Here

        Hashtable tempMap = new Hashtable();
        tempMap.put(TextAttribute.FAMILY, defaults.get(TextAttribute.FAMILY));
        tempMap.put(TextAttribute.WEIGHT, defaults.get(TextAttribute.WEIGHT));
        tempMap.put(TextAttribute.POSTURE, defaults.get(TextAttribute.POSTURE));
        tempMap.put(TextAttribute.SIZE, defaults.get(TextAttribute.SIZE));
        fDefaultFontMap = new AttributeMap(tempMap);
    }
View Full Code Here

    public AttributeMap applyFont(AttributeMap style) {

        Object cachedMap = styleMap.get(style);

        if (cachedMap == null) {
            AttributeMap resolvedMap = resolve(style);
            styleMap.put(style, resolvedMap);
            return resolvedMap;
        }
        else {
            return (AttributeMap) cachedMap;
View Full Code Here

    /**
     * Fill the layout info with information appropriate to the pseudoline.
     */
    private synchronized LayoutInfo pseudoLineInfo(LayoutInfo info, int offset)
    {
        AttributeMap st = fText.paragraphStyleAt(fLTCurTextLen); // ??? if text is empty or this is the end of the text, what happens?
        ParagraphRenderer renderer = getRendererFor(st);
        info = renderer.layout(fText,
                               info,
                               (LineBreakMeasurer)null,
                               fFontRenderContext,
View Full Code Here

            }
           
            if (measurer != null) {
                // need to set up renderer since the paragraph update in the
                // formatting loop will not happen
                AttributeMap style = fText.paragraphStyleAt(curParagraphStart);
                renderer = getRendererFor(style);
                measurer.setPosition(curLineStart);
            }
        }
       
        if (measurer == null) {
            // trigger paragraph update at start of formatting loop
            curParagraphLimit = curParagraphStart;
            curParagraphStart = 0;
        }

        fLTCurTextLen = newCurTextLen;
       
        while (true) {
            // System.out.println("line: " + fLTPosEnd + ", cls: " + curLineStart);


            if (curLineStart >= curParagraphLimit) {
                curParagraphStart = curParagraphLimit;
                curParagraphLimit = fText.paragraphLimit(curParagraphStart);

                AttributeMap style = fText.paragraphStyleAt(curParagraphStart);
                renderer = getRendererFor(style);

                if (curParagraphStart < curParagraphLimit) {
                    measurer = makeMeasurer(curParagraphStart, curParagraphLimit);
                    measurer.setPosition(curLineStart);
View Full Code Here

    * text is empty or ends with a newline.
    */
    private int lastCharHeight()
    {
        int charIndex = lastLineCharStop() - 1;
        AttributeMap st = fText.characterStyleAt(charIndex);
        DefaultCharacterMetric.Metric metric = fDefaultCharMetric.getMetricForStyle(st);

        int height = metric.getAscent();
        height += metric.getDescent();
        height += metric.getLeading();
View Full Code Here

TOP

Related Classes of com.ibm.richtext.textlayout.attributes.AttributeMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.