andryblack / fontbuilder

Bitmap font generator
MIT License
454 stars 99 forks source link

Tightly pack the texture with multilevel sort #11

Closed doug65536 closed 10 years ago

doug65536 commented 10 years ago
andryblack commented 10 years ago

this features must be optional. e.g. subclass BoxLayouter as SortedBoxLayouter. 32pixel align must be optional too, for this need more complex code refactoring. All layouters may contain list of texture-size-generators. Sorry for bad english.

doug65536 commented 10 years ago

I have updated my pull request. I refactored the optimizer into a separate layouter, which is based on the existing box layouter.

I extended AbstractLayouter to have a virtual OptimizeLayout(QVector<LayoutChar>&) which gives an opportunity for the layouter to optimize the layout. If the subclass doesn't implement OptimizeLayout, an empty implementation is provided by AbstractLayouter.

I made a new class BoxLayouterOptimized which inherits BoxLayouter, that implements OptimizeLayout.

I updated the optimizer sort to use qSort instead of C++ std::sort. The comparator is now a function instead of a functor.

I added a new spinner to the GUI, which lets the user adjust the rounding of the size to a given multiple. I have extended the layout config appropriately.

andryblack commented 10 years ago

Thanks