HI Mike,
Text Tags are applied to the TextBuffer, once the text is loaded into it. I use the Gtk::TextBuffer::create_tag() function, so the tag is created and added to the textbuffer immediately, which seems more convenient than constructing the tag and then adding it to the buffer separately. some sample code: Gtk::TextView* AView = Gtk::manage(new Gtk::TextView()); Glib::RefPtr< Gtk::TextBuffer > ABuff = AView->get_buffer(); Glib::RefPtr<Gtk::TextBuffer::Tag> refTagBold = ABuff->create_tag(); refTagBold->property_weight() = Pango::WEIGHT_ULTRABOLD; //set the text in the buffer, and identify what you want to apply a tag to; then: Gtk::TextBuffer::iterator start_it = ABuff->get_iter_at_offset(start_of_highlight); Gtk::TextBuffer::iterator end_it = ABuff->get_iter_at_offset(end_of_highlight); ABuff->apply_tag(refTagBold, start_it, end_it); Ian. On 25/07/14 18:20, mike lear wrote:
|