public void CellFit(final float w, final float h, final String txt, final Borders border, final Position ln,
			final Alignment align, final boolean fill, final int link, final ScaleMode scale, final boolean force)
			throws IOException {
		// Get string width
		float str_width = this.getStringWidth(txt);

		// Calculate ratio to fit cell
		float w1 = (w == 0) ? this.w - this.rMargin - this.x : w;
		float ratio = (w1 - this.cMargin * 2) / str_width;

		boolean fit = ((ratio < 1) || ((ratio > 1) && force));
		if (fit) {
			switch (scale) {

			// Character spacing
			case CHARSPACE:
				// Calculate character spacing in points
				float char_space = (w1 - this.cMargin * 2 - str_width) / Math.max(txt.length() - 1, 1) * this.k;
				// Set character spacing
				this._out(String.format(Locale.ENGLISH, "BT %.2f Tc ET", Float 
						.valueOf(char_space)));
				break;

			// Horizontal scaling
			case HORIZONTAL:
				// Calculate horizontal scaling
				float horiz_scale = ratio * 100.0f;
				// Set horizontal scaling
				this._out(String.format(Locale.ENGLISH, "BT %.2f Tz ET", Float 
						.valueOf(horiz_scale)));
				break;

			}
			// Override user alignment (since text will fill up cell)
			this.Cell(w1, h, txt, border, ln, null, fill, link);
		} else {
			// Pass on to Cell method
			this.Cell(w1, h, txt, border, ln, align, fill, link);
		}

		// Reset character spacing/horizontal scaling
		if (fit) {
			this._out("BT " + (ScaleMode.CHARSPACE.equals(scale) 
			? "0 Tc"
					: "100 Tz") 
					+ " ET");

		}
	}