[AGAIN]Printing text as text using printer.?


#1

Do we have any thing for printing text as text.? LowLevelGraphicsPostScriptRenderer does allow us to print image very easily, but what do we need to do for text.? Printting text as image would be bad idea so is there anything that can help.?


#2

LowLevelGraphicsPostScriptRenderer?


#3

Sorry mis-typed in hurry.. yah ofcourse its LowLevelGraphicsPostScriptRenderer. 


#4

It handles paths - the best way to do text would be to convert it to a path and print that, I guess.


#5

Sorry to bother you but i tried doing it using path i still didn't get it. Can you please give me a little hint about what to use.?

Thanks for your reply.


#6

Try GlyphArrangement::createPath()


#7

Thank jules for your reply. i got it working. Here is how i hot that may be this will useful to others in future.

 


        MemoryOutputStream out;
        Graphics g (myImage);
        LowLevelGraphicsPostScriptRenderer low(out, "hi", 600, 842);
        juce::Path textPath;
        juce::GlyphArrangement glyphs;
        glyphs.addFittedText(juce::Font(12), "Hitesh", 5, 50, 600, 842, juce::Justification::left, 2);
        glyphs.createPath(textPath);
        g.setColour (juce::Colours::white);
        juce::PathStrokeType strokeType(2.5f);
        g.strokePath(textPath, strokeType);
        g.setColour (juce::Colours::black);
        low.fillPath(textPath, juce::AffineTransform());