[GIS] OpenLayers 3 Style – text label with size not depending on scale

openlayersscaletext;

I try to label polygons from a WFS-Source with an attribute. This works fine, but my problem is that the size of this label is scale depending. It has the same size on every scale. But i want it to become smaller/bigger if i zoom out/in the map. Like the polygons become smaller zooming out the map.
How can i get this with Openlayers?

This is the problem in pictures:
Zoom in - small labels
Zoom out - big labels

Here is the code i use:

var Flst_GbR = new ol.layer.Vector({
        source: new ol.source.Vector({
        loader: function(extent) {
            $.ajax('http://192.168.10.9:8096/geoserver/IIS_Becker/wfs', {
                type: 'GET',
                data: {
                    service: 'WFS',
                    version: '2.0.0',
                    request: 'GetFeature',
                    typename: 'IIS_Becker:Flurstücke_GbR',
                    srsname: 'EPSG:2398',
                    outputFormat: 'application/json'
                }
            }).done(function(response) {
                Flst_GbR.getSource().addFeatures(new ol.format.GeoJSON().readFeatures(response));
            });
        },
        strategy: ol.loadingstrategy.all,
        projection: customprojection
        }),
        style: function(feature, resolution) {
            var stylestößen = new ol.style.Style({
                stroke: new ol.style.Stroke({
                    color: 'rgba(255,0,0,1.0)',
                    width: 1
                }),
                fill: new ol.style.Fill({
                    color: 'rgba(253,184,184,0.5)'
                }),
                text: new ol.style.Text({
                    text: feature.get('flurstueck')
                })
            });
            var stylegörschen = new ol.style.Style({
                stroke: new ol.style.Stroke({
                    color: 'rgba(255,128,0,1.0)',
                    width: 1
                }),
                fill: new ol.style.Fill({
                    color: 'rgba(255,193,132,0.5)'
                })
            });
            if ( feature.get('gemarkung') == 'Stößen') {
                return [stylestößen];
            } else {
                return [stylegörschen];
            }
        }
    });

How do i have to change the code on the ol.style.Text-object to get it work?

Best Answer

I used this formula

    var zoom = map.getView().getZoom();
    var dsize = (100 / resolution) * zoom;
    var size = Math.round(dsize) + "px" //dom.size.value;