Unable to change font in BTextView

Hi all,
this is my first time posting here.
I am Johannes from Germany. So pls apologize my bad english.
And i really love Haiku :slight_smile:

So… i’m about programming some software for Haiku.
While that, i’m struggled of lots of problems…
First of all, i tried to make my GUI with the Layout lib. Works bad.
Lots of graphic errors.
So i decided to make my GUI the old way :wink:
Works perfect… till now.

I have a BTextView and i wanna change the font size and color in there.
But it just dont work!

I even tried in a small project with just a BTextView…

: BWindow(BRect(100,100,500,400),“Main Window”,B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS)
BRect r(Bounds());
r.bottom = 20;
fMenuBar = new BMenuBar(r,“menubar”);
r = Bounds();
r.top = 20;

BTextView* fTextView = new BTextView(r,"textview",BRect(0,0,1000,1000),B_FOLLOW_ALL);

BFont font;


But it just dont work.

The font remains the same…

BTextView uses a text_run_array structure to describe fonts and colors of the text.
You can modify the structure easily with:

I suggest to use layout or your application will not scale with different fonts.

Thanks for your answer. As i said, it tryed to us the Layout api. But it works not really good. I got lots of graphic failures. But it will try to test the text_run_array. Thx alot

And i tryed SetFontAndColor many times in many ways… did not work…

It would really help to see the code. Also of your layout management adventures. All apps coming with Haiku and many 3rd party apps are using it successfully, so there has to be something wrong with the code.
I suggest putting it into a github repo.

Oh, I dont think its the libs fault.
It think i had faults in my code.
But yea, i decided to build my GUI the old way. Seems to that i have more control over it.

BTW i dont know how to put my code on git :wink:

Actually, i’m working on a IDE for Haiku. I dont think that Paladin is really usefull.

I’d be surprised if there aren’t a few dozen tutorials and videos about that around… )

Paladin is under heavy development by @adamfowleruk currently. Give him a bit more time to squash the dozens of bugs he catalogued…


1 Like

I’m a little surprised that there’s no “HaiCode”
Heidi is pretty close, though.


Hooo… i will take a closer look to all of them. Mine is name HaIDE :wink:

Well, paladin is great. But its not an IDE. So… i would be glad to see it as one.

Some are admittedly old/unmaintained, with ideam being the most recently updated. Please consider contributing to these existing projects instead of starting from scratch :slight_smile:

You are right KapiX, but there is always the… you know… to make something special. for your own. I know its ridicoulus… but hey… its a hobby for me… so as i said, i’ll take a look at the others and maybe, just maybe i can help a little bit.

1 Like

Sure, I get that. You might get there (making something special) faster starting with some foundation though :slight_smile:

But im not really sure how got get in contact with those guys.
And i am shy to release my work. I know i can code, but i’m not that good as those
guys who wrote the Haiku Kernel.

More than happy to take volunteers to mould Paladin. The version in Haiku Depot is quite old and buggy.

Please take a look at the milestones on Github for Paladin to see the ideas and options we’re playing with. Especially the Developer Work flow and UI Experiments milestones. Lots of interesting things there, and I’m more than happy to experiment with unique takes on things. No need for you to start from scratch.

Paladin should be ready for a 1.5 release that fixes all outstanding bugs in the next 3 weeks. Hoping to finish before BeGeistert in Hamburg. After that it’ll be around ease of development, template projects, and other things to make coding for Haiku easier. (E.g. A template window app with controls and layouts preconfigured and working!)

Please do consider lending a hand.


You don’t have to be. Everyone was a beginner sometime. :slight_smile:
Releasing your work and have people more experienced look at it might even speed up your learning process.

Sending a Pull Request is a good way to do that.

If you want to get help wrt using git feel free to DM or email me directly. :slight_smile:

I can’t speak for AmosCaster, but waddlesplash is one of Haiku developers and HaikuArchives is a fairly active org where any PR is appreciated and will be looked at pretty soon.

I think the issue Samson has with Paladin is its multi-window GUI. I wouldn’t want to see that go, but it’s fine some people don’t like it.

Yes, Paladins Multi Window is not what i like. An IDE for me is a, as it sais, integrated development environtment. So, all in one place. Its really enerving to switch throu tens of windows.

THX to all. I was able to change Font and Color in the BTextView now. As always, it was a human
failure :wink:
THX for you help!

That makes sense. Paladin currently uses an external editor. I am toying with the concept of saved Window Layouts that would be restored on opening a project. So all the editor windows would be reopened in their exact previous state and location. (May be useful to other apps, so I’d add this is a separate library).

I also need to look at the replicant code to see if it’s feasible to grab most of an application and embed it. E.g. A Pe editor window’s content within a Paladin Window. That would be a cheap way to get an IDE.