• What rules should be added to this code to display larger or smaller text?

    `//PHP doesn’t honor lazy matches very well, apparently, so add newlines
    $raw = str_replace( ‘}’, “}\r\n”, $raw );

    preg_match_all( ‘#.c(?P<digit>\d+){(.*?)font-weight:700(.*?)}#’, $raw, $boldmatches );
    preg_match_all(‘#.c(?P<digit>\d+){(.*?)font-style:italic(.*?)}#’, $raw, $italicmatches);

    if( !empty( $boldmatches[ ‘digit’ ] ) ) {

    foreach( $boldmatches[ ‘digit’ ] as $boldclass ) {
    $raw = preg_replace( ‘#<span class=”(.*?)c’ . $boldclass . ‘(.*?)”>(.*?)</span>#s’, ‘<span class=”$1c’ . $boldclass . ‘$2″>$3</span>’, $raw );
    }

    }

    if( !empty( $italicmatches[ ‘digit’ ] ) ) {

    foreach( $italicmatches[ ‘digit’ ] as $italicclass ) {
    $raw = preg_replace( ‘#<span class=”(.*?)c’ . $italicclass . ‘(.*?)”>(.*?)</span>#s’, ‘<span class=”$1c’ . $italicclass . ‘$2″>$3‘, $raw );
    }

    }

  • The topic ‘What do I need to add for it to recognize text size?’ is closed to new replies.